How to change 'with_front” key from an existing custom post type?

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 🙂

Solutions Collecting From Web of "How to change 'with_front” key from an existing custom post type?"

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.

Additionally, if the CPT has taxonomies associated with it, I’ve successfully used the following code to rewrite those as well:

/**
 * Set 'with_front' to false for the 'portfolio_category' post taxonomy.
 */

add_filter( 'register_taxonomy_args', function( $args, $taxonomy )
    {
        if( 'portfolio_category' === $taxonomy && is_array( $args ) )
            $args['rewrite']['with_front'] = false;
        return $args;
    }, 99, 2 );

In case that is helpful to anyone.

This solution works, added to parent theme functions.php:

        add_filter( 'register_post_type_args', function( $args, $post_type )
        {
            $args['rewrite']['with_front'] = false;
            return $args;
        }, 10, 2 );