Support

Home Forums Event Espresso Premium How to change category base slug?

How to change category base slug?

Posted: May 8, 2018 at 6:28 am


yaegerhunter

May 8, 2018 at 6:28 am

I upgraded to premium hoping for a way to change the /event-category/ base slug because it conflicts with the church calendar plugin I’m using, it also uses a /event-category/ base slug so I get 404 errors. I’ve searched around and don’t get a clear answer to this specific issue. Any ideas?

Thank you!


Josh

  • Support Staff

May 8, 2018 at 9:23 am

Hi there,

You can change the EE4 event category base slug by adding a bit of PHP code to your site:

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.

After the code is uploaded you’ll need to make one visit to the site’s Settings → Permalinks page to flush the rewrite rules.


yaegerhunter

May 8, 2018 at 10:36 am

I placed it, updated permalinks, cleared cache and still doesn’t pick up this new base slug… Here is my version… does it have to go in a specific spot in the functions.php file?

add_filter(
‘FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies’,
‘ee4-signups’,
10
);
function my_custom_event_category_basename( array $taxonomies ) {
$taxonomies[‘espresso_event_categories’][‘args’][‘rewrite’][‘slug’] = ‘ee4-group’;
return $taxonomies;
}

I’ll do a plugin or child theme approach, just trying to get this working now. Thank you!


Josh

  • Support Staff

May 8, 2018 at 11:04 am

Hi,

Your version isn’t valid because my_custom_event_category_basename is actually the function name. The function name can be whatever you want to call it, but it must be unique (or PHP will throw a fatal error). Also, the filter callback must match the function name.

In other words: If you want to change the function name to something like “yaegerhunter_custom_category_function”, your code will be:

add_filter( 
    'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
    'yaegerhunter_custom_category_function', 
    10 
);
function yaegerhunter_custom_category_function( array $taxonomies ) {
    $taxonomies['espresso_event_categories']['args']['rewrite']['slug'] = 'ee4-group';
    return $taxonomies;
}

The support post ‘How to change category base slug?’ 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