Home Forums Event Espresso Premium Custom permalinks

Custom permalinks

Posted: March 1, 2019 at 6:47 pm


March 1, 2019 at 6:47 pm

Hi there,
I’m using the advice Josh provided here:
and this code:
It works great!
I’ve also got the permalink manager plugin.

One thing i’d like to change though, and I can’t seem to do this with the permalink plugin, is to use only the parent event category in the url. As it is, the function adds all of the selected event categories to the slug.

i.e. Instead of “../workshops/2day/act-i-san-diego/”
I’d prefer to have “../workshops/act-i-san-diego/”

Can you provide any suggestions?


March 3, 2019 at 8:28 pm

Now I see that using the Permalinks Manager (lite) plugin causes a fatal error to


and my event dates.

I was using this super helpful code that Josh posted on my site to display the venue addresses in a custom format on my custom event templates. The following error appears, and the dates and times display is also broken:

Fatal error: Uncaught Error: Call to a member function name() on null in ../wp-content/themes/astra-child/functions.php:78 Stack trace: #0 ../wp-content/themes/astra-child/page-event-info.php(122): espresso_venue_address() 

When i deactivate the permalinks manager, everything returns to normal. Do you guys have any ideas about why this plugin might be interacting poorly with EE? Or perhaps you know of an alternative permalinks plugin?

I’m using EE 4.9.78.p on WP 5.1.


March 3, 2019 at 9:00 pm

Actually, i guess i don’t really need to use the permalinks plugin. Please ignore that question. If you could help me get this code ( to insert only the parent category into the slug, then everything will be gravy.


  • Support Staff

March 4, 2019 at 2:16 pm

Hi there,

That function Josh provided does not add all of the slugs to the URL, it adds the first category slug to the URL. For example –

Have you changed the ‘Events’ slug, to ‘Workshops’ but also have a category called ‘Workshops’ by any chance?

The code from Josh that you mentioned jumps through a lot of hoops to try and make sure it grabs a venue object and the reason it’s blowing up is it can’t find one. So although you aren’t using the other solution now anyway, that code could do with a quick sanity check, where it has:

$venue = EEH_Venue_View::get_venue( $VNU_ID );

(get_venue is what is doing a lot of hoop jumping to try and find your venue for you)

Right after it add:

if(! $venue instanceof EE_Venue ) {

Which will jump out of the function if it can’t find a venue and prevent the fatal you posted.


March 5, 2019 at 9:17 pm

Hi Tony,
Thanks for the edit to Josh’s code. I’ll try that out with the permalinks manager again.

Sorry, I misrepresented the problem when I wrote that the code added all of the categories. I agree that it only adds one category, but it seems to use the lowest-ranked category, not the parent.
Here’s an example, and I have 50+ more:
The only way to get it to use the parent category is to uncheck all of the child categories.
Would something like this improve my outcome do you think?



  • Support Staff

March 6, 2019 at 4:34 am

Hi Hilary,

Sure, you can use get_terms(), you’d swap out:

$terms = wp_get_object_terms( $post->ID, 'espresso_event_categories' );

For something like:

$terms = get_terms( array(
        'taxonomy' => 'espresso_event_categories',
        'parent' => 0

Note you’ll run into a similar problem if you have multiple ‘parent’ categories on an event.

The support post ‘Custom permalinks’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Tony 1 year, 6 months ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!