I have a CPT called ‘experts’, that has been created in a theme I bought, and I can’t find out where nor where to change it.
I need to change a parameter to ‘with_front’ => false
Because my general permaling structure goes with /blog and I do’nt want experts to be in /blog/experts.
Is there a way I could do that adding something in the functions file?
I have tried this (How to set “with_front’=>false” to a plugin-generated cpt?) and various things, but could not get it to work.
Thanks 🙂

3 s
3

You could try the newly register_post_type_args filter to adjust it.

Here’s an untested example:

/**
 * Set 'with_front' to false for the 'experts' post type.
 */
add_filter( 'register_post_type_args', function( $args, $post_type )
{
    if( 'teachers' === $post_type && is_array( $args ) )
            $args['rewrite']['with_front'] = false;

    return $args;
}, 99, 2 );

Updated with new info from @Agnes: the post type is teachers not experts.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *