edwardr/staffer

Ability to change `with_front`

mrwweb opened this issue · 1 comments

The Staff post type rewrite is set so that with_front is true. Unfortunately, that means you can get profile links like example.org/blog/staff/person/ because with_front appends the page_for_posts slug to the URL.

I suspect that just changing the plugin would probably break links on existing sites, so it seems that a filter might be the best option here. Happy to submit a pull request.

Current workaround:

<?php
add_action( 'init', 'staffer_rewrite_sans_with_front', 11 );
/**
 * change 'staff' CPT from Staffer plugin to not use `with_front` for rewrite
 */
function staffer_rewrite_sans_with_front() {
    $staff = get_post_type_object( 'staff' );
    if( $staff != false ) {
        $staff->rewrite['with_front'] = false;
        register_post_type( 'staff', (array) $staff );
    }
}