Support

Home Forums Event Espresso Premium Removing /blog/ from events url

Removing /blog/ from events url

Posted: September 6, 2022 at 7:35 pm

Viewing 3 reply threads


Digital Services Lab

September 6, 2022 at 7:35 pm

Hello,

My sites permalink structure is /blog/%postname%/

I see that this then causes issues with event and venue urls, which also get the /blog/ prefix.

I sifted through the code base and noticed that the ‘rewrite’ argument is filtered so I’ve done the follwing which has fixed the issue, but I’m wondering if this is a safe solution – as in, is it likely to cause any other problems elsewhere in Event Espresso?


add_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite', 'dsl_update_events_rewrite_rules',10,1);

function dsl_update_events_rewrite_rules($rewrite) {

$rewrite['with_front'] = false;

return $rewrite;

}


Tony

  • Support Staff

September 7, 2022 at 8:55 am

Hi there,

As far as I am aware, the above change should be fine. It applies to ALL custom post types within Event Espresso, meaning any of our custom post types will no longer use /blob/ in the URL but I assume that is what you want to do anyway?

Did you manually set the above permalink structure?


Digital Services Lab

September 7, 2022 at 5:15 pm

Hi Tony,

Thank for the response. Yes, I do want all the EE CPTs to not use that prefix.
Yes, I did manually set that permalink structure as I don’t want actual blog posts to be at the top level of the URL path. There’s probably a better way of achieving that, that specifically targets ‘post’ post types… but this is just how I’ve normally done it.


Tony

  • Support Staff

September 8, 2022 at 6:45 am

Then yes, the above should work fine as far as I am aware 🙂

Viewing 3 reply threads

The support post ‘Removing /blog/ from events 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