Support

Home Forums Event Espresso Premium Event Slug 404 Error Page

Event Slug 404 Error Page

Posted: October 28, 2020 at 7:47 am


recycletompkins

October 28, 2020 at 7:47 am

We have been experiencing what a lot of others have complained about. Our event pages were getting 404 error pages so we followed your suggestion and edited the event template to use a slug other than ‘events’. In our case that was changed to “hhw_events”. And that worked, for a while.

Every few days the issue represents itself and we now have to go in and resave their permalink structure. Here are the steps that we do:

– I loaded the page and got the 404 Error.
– I then re-saved the event template ‘hhw_event’ slug and refreshed the page – still a 404 error. (note – I don’t change the slug now since we already changed it so ‘hhw_event’, I just save the existing settings)
– I then re-saved the permalink structure and it loaded correctly.

Do you know what would cause this to keep happening?Is there anything we can do to make this a permanent fix so we don’t have to reset everything every few days?

Thanks so much for your help!


Tony

  • Support Staff

October 28, 2020 at 8:28 am

Hi there,

Our event pages were getting 404 error pages so we followed your suggestion and edited the event template to use a slug other than ‘events’. In our case that was changed to “hhw_events”. And that worked, for a while.

The only time you should need to change it to something other than events is if something else is already using that slug and overriding EE’s rewrite rules. Sometimes something can cause permalinks to flush at an unexpected point in the request which then ‘loses’ Event Espresso’s rewrite rules, in that case flushing permalinks (opening up Settings -> Permalinks) should fix it.

You’ve already changed the permalinks now so keep using those, but just a note for future readers.

Every few days the issue represents itself and we now have to go in and resave their permalink structure. Here are the steps that we do:

– I loaded the page and got the 404 Error.
– I then re-saved the event template ‘hhw_event’ slug and refreshed the page – still a 404 error. (note – I don’t change the slug now since we already changed it so ‘hhw_event’, I just save the existing settings)
– I then re-saved the permalink structure and it loaded correctly.

You likely only need the last step there to flush permalinks and have the posts work again.

Do you know what would cause this to keep happening?Is there anything we can do to make this a permanent fix so we don’t have to reset everything every few days?

Not from the info we have but are you comfortable with PHP and FTP? I can give you a snippet to add to your site (and you’ll need to make a change to wp-config.php) and whilst it wont fix the problem, it may help highlight what is causing it.

In short the snippet will write a log entry each time your site flushes permalinks with a stack trace of the function that called it. So you add the snippet, enable WP_DEBUG_LOG on the site and then wait for it to happen again. When it does you fix the permalinks again and send over the log so we can investigate.

Is that something you are comfortable with?


recycletompkins

October 28, 2020 at 9:12 am

Thanks Tony! I am certainly comfortable with that so if you send it over I can give it a try. Thanks so much for your help and quick reply!


Tony

  • Support Staff

October 28, 2020 at 9:52 am

This snippet:

https://gist.github.com/Pebblo/a6d2b949d0ae784c09de442b9848ff7d

That in itself is a plugin but you can add the to a custom functions plugin if preferred, we have documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

You’ll need to enabled WP_DEBUG and WP_DEBUG_LOG for this, we recommend using this code:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

That’ll log the entries to /wp-content/debug.log. I recommend you add the snippet and flush permalinks, then check that file contains a log entry to make sure its working, then when the slug breaks, thats the file I need to see.


recycletompkins

November 5, 2020 at 11:26 am

Hi Tony,

I believe I followed your directions properly but I see no debug file. Is there another place it might go or another way to access those logs? I can see the error log but not a debug log.

Thanks!


Tony

  • Support Staff

November 6, 2020 at 2:51 am

No, the above sets it up to log in /wp-content/debug.log

So, starting from the beginning, the custom functions plugin you’ve created is installed and activated on the site, correct? (Check in Dashboard -> Plugins and confirm the plugin is activated and not just installed)

You’ve added the code shown here:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

In your wp-config.php file?

Note that snippet needs to go before the line /* That's all, stop editing! Happy publishing. */, you should have already had something like define( 'WP_DEBUG', true ); and that snippet replaces that single line.

Like this: https://monosnap.com/file/TmFcsuI3goTOuyCxgPKYO1tn6NQdPr


recycletompkins

November 9, 2020 at 8:37 am

Hi Tony,

Ok, I had put that below the line so hopefully we can wait for the error to present again and I will get the debug log for you. Thanks for the help!


Tony

  • Support Staff

November 10, 2020 at 2:44 am

Ok, I’ve just checked the site to confirm the log worked and it does, however as your using different events slug from the default one you’ll need to edit line 29:

https://gist.github.com/Pebblo/a6d2b949d0ae784c09de442b9848ff7d#file-tw_log_rewrite_rules_array-php-L29

To be:

'EE-Check' => isset($rewrite_array['hhw_events/?$']) ? 'true' : 'false'

The log still works without that change, but the EE-Check is a quick way to spot when the permalinks break.


recycletompkins

November 24, 2020 at 1:20 pm

Hi Tony,

Ok, I reviewed the log again and is this the error code you needed to further troubleshoot?

[stacktrace] => #0 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-hook.php(287): tw_log_rewrite_rules_array(Array)
#1 /home/ytjcqccof1xv/public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array)
#2 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-rewrite.php(1446): apply_filters(‘rewrite_rules_a…’, Array)
#3 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-rewrite.php(1467): WP_Rewrite->rewrite_rules()
#4 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-rewrite.php(1808): WP_Rewrite->wp_rewrite_rules()
#5 /home/ytjcqccof1xv/public_html/wp-content/plugins/all-in-one-seo-pack/modules/aioseop_sitemap.php(1593): WP_Rewrite->flush_rules()
#6 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-hook.php(287): All_in_One_SEO_Pack_Sitemap->flush_rules_hook(”)
#7 /home/ytjcqccof1xv/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
#8 /home/ytjcqccof1xv/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#9 /home/ytjcqccof1xv/public_html/wp-settings.php(562): do_action(‘wp_loaded’)
#10 /home/ytjcqccof1xv/public_html/wp-config.php(111): require_once(‘/home/ytjcqccof…’)
#11 /home/ytjcqccof1xv/public_html/wp-load.php(37): require_once(‘/home/ytjcqccof…’)
#12 /home/ytjcqccof1xv/public_html/wp-login.php(12): require(‘/home/ytjcqccof…’)
#13 {main}
[EE-Check] => false
)

If not, what can I send you that will be useful? Thank you so much for your help!


Tony

  • Support Staff

November 24, 2020 at 3:08 pm

Ok so All In One SEO is calling flush permalinks on the wp-login request, we don’t run EE on that request so EE rules won’t be added.

Try adding this snippet to your site:

https://gist.github.com/Pebblo/fd47c19d038ec7b5ce0aa397ba2aacc4

Add it to your custom functions plugin and not your theme’s functions.php file, then flush permalinks and see if it happens again.


recycletompkins

November 25, 2020 at 12:26 pm

Thanks Tony! I will add that in and see if we run into any other problems in the next week or two!


Tony

  • Support Staff

November 25, 2020 at 12:31 pm

Fingers crossed 🙂

You must be logged in to reply to this support post. Sign In or Register for an Account

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: publish

Updated by  Tony 1 week ago ago

Topic Tags

Notifications

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