Support

Home Forums Event Espresso Premium How to change event category slug while also removing the first path in the URL

How to change event category slug while also removing the first path in the URL

Posted: January 11, 2019 at 9:30 am

Viewing 3 reply threads


mireaux2019

January 11, 2019 at 9:30 am

Our site permalink is set to website.com/blog/ I was able to remove /blog/ from our events by adding a function with this in it, the with_front removed /blog/:

$custom_slug = array( 'slug' => 'myeventslug', 'with_front' => false );

I found this code for changing category slug, but it won’t remove the /blog/ and I don’t know how to modify it to include the with_front line


add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'my_custom_event_category_slug');
function my_custom_event_category_slug( $thearray ) {
if ( !empty($thearray['espresso_event_categories']) ) {
$thearray['espresso_event_categories']['args']['rewrite']['slug'] = 'mycategoryslug';
return $thear
}
return $thearray;
}

Doing that code just turns the category links to website.com/blog/mycategoryslug/categoryname


Josh

  • Support Staff

January 11, 2019 at 10:20 am

This is documented in the codex:
https://codex.wordpress.org/Function_Reference/register_post_type#rewrite

so one way to do this is add another array item e.g.
$thearray['espresso_event_categories']['args']['rewrite']['with_front'] = false;

One other thing to note is
FHEE__EE_Register_CPTs__get_taxonomies__taxonomies
is deprecated. You can use
FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies
instead.


mireaux2019

January 11, 2019 at 1:58 pm

That worked, thank you!


mireaux2019

January 11, 2019 at 1:58 pm

That worked, thank you!

Viewing 3 reply threads

The support post ‘How to change event category slug while also removing the first path in the URL’ 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