Support

Home Forums Event Espresso Premium Ignore front base in permalink structure

Ignore front base in permalink structure

Posted: March 18, 2014 at 11:57 am

Viewing 2 reply threads


Miguel Ángel García Martínez

March 18, 2014 at 11:57 am

Hi,

I need to use a constant base in all my blog posts permalinks (/blog/) but changing this via the Settings > Permalinks also affects the permalinks used by Event Espresso. My understanding is that, when registering the custom post type, the parameter ‘with_front’ must be set to false in the rewrite arguments so that the permalinks for this new CPT do not use the constant base.

Besides EE, I use other CPTs and these are not affected by the permalink base, as I’ve set the with_front parameter to false when registering them.

My question is, where can I change this parameter in the plugin? If I change it manually, will these changes be overwritten when upgrading the EE version? Would you consider adding this parameter by default in future versions? or at least a way to change it from the Admin panel…

Kind regards,
Mike


Josh

  • Support Staff

March 18, 2014 at 2:24 pm

Hi Mike,

It turns out that you don’t change this in the plugin because there is a filter in place that lets you override the defaults. Here’s something you can add to a custom snippet plugin that will keep the slug as events (which you can also change) and change the WP default from true to false for ‘with_front’:

add_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', 'my_custom_cpt_rewrite', 10, 2 );
function my_custom_cpt_rewrite( $slug, $post_type ) {
    if ( $post_type == 'espresso_events' ) {
        $custom_rewrite = array( 'slug' => 'events', 'with_front' => false );
        return $custom_rewrite;
    }
}


Miguel Ángel García Martínez

March 18, 2014 at 2:51 pm

Thanks for a quick and accurate response Josh!

This fixes the problem.

Kind regards.
Mike


Josh

  • Support Staff

March 18, 2014 at 2:54 pm

You’re welcome.

Viewing 2 reply threads

The support post ‘Ignore front base in permalink structure’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso