• Resolved Matt Cromwell

    (@webdevmattcrom)


    I have a custom structure in my permalinks that looks like this:

    /blog/%postname%/

    This is so all my blog posts have that prefix.

    But the Podcast episodes are inheriting that as well. I read up on it and it seems it’s because when the podcast taxonomy is registered in your plugin there is no argument for rewrite with_front so it defaults to TRUE.

    This is in /php/classes/handlers/class-cpt-podcast-handler.php

    I was able to write this snippet to make it work for my purposes:

    function mattc_set_ssp_tax_no_front( $args ) {
    	$slug   = apply_filters( 'ssp_archive_slug', __( SSP_CPT_PODCAST, 'seriously-simple-podcasting' ) );
    	
    	$args[ 'rewrite' ] = array( 'slug' => $slug, 'feeds' => true, 'with_front' => false );
    
        return $args;
    
    }
    
    add_filter('ssp_register_post_type_args','mattc_set_ssp_tax_no_front');

    All that to say… I’d love a setting to ensure the Podcast slug does NOT inherit the site permalink structure if possible.

    Other than that, so far so good! Really impressed with this plugin. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    Hi @webdevmattcrom!

    Thank you for bringing it to our attention.
    I agree that most users would like to have it in the false state. But for historical reasons, it was set to true, and we decided not to change it because it can affect users who already use it as with_front=true.
    So, if you don’t need to change anything else, you can use the following more compact snippet:

    add_action( 'ssp_register_post_type_args', function ( $args ) {
    	$args['rewrite']['with_front'] = false;
    
    	return $args;
    } );
    Thread Starter Matt Cromwell

    (@webdevmattcrom)

    Love it! I’m a total hack when it comes to snippets, so I really appreciate this!

    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    @webdevmattcrom
    No problem, happy that my snippet suggestion was helpful for you ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set rewrite with_front to false’ is closed to new replies.