Support

Home Forums Event Espresso Premium 404 Page for Sold Out Events

404 Page for Sold Out Events

Posted: November 20, 2019 at 8:58 am

Viewing 5 reply threads


presleydesign

November 20, 2019 at 8:58 am

Whenever an event moves to Sold Out, the event details page automatically starts generating a 404 error page and is not publicly viewable again. I’ve reviewed previous, similar posts here and they seem to be a theme-specific issue. I’ve set these Sold Out events to Publish and they just revert back to the Sold Out status. I’ve re-saved my Permalinks and still have 404s. The Health Check plugin/tool reveals no specific results or issues. What are my next steps to fix this? I still want the details pages of sold out events viewable, but not be able to register for that event. What are my next steps here?


Josh

  • Support Staff

November 20, 2019 at 9:41 am

Hi,

This might be caused by some theme code that modifies the standard WordPress query. We’ve seen this before where the theme hard codes in “Published” as the only viewable post status. In this case though, you also want a post with “Sold Out” status to be viewable too.

Here’s a quick way to check to see if it is the theme causing this:

1) Log into the site as an admin
2) Go to the sold out event page that has the 404 error
3) Click the “Customize” link in the toolbar
4) Preview (but don’t publish the changes) another installed theme (there should be a “twentysomething” theme installed)

With the other theme preview, does the event content display without a 404 error?

If so, then that indicates the theme is the problem. We’ve fixed this same problem before for another theme, and this was the code:

https://gist.github.com/joshfeck/16407ed5c86c029127959c7ed8a44c29

We can provide a similar fix for your theme if you can send or provide a link where we can download a copy of the theme.


presleydesign

November 20, 2019 at 9:51 am

This reply has been marked as private.


Josh

  • Support Staff

November 20, 2019 at 11:56 am

Hi,

Thank you. You can fix this by adding the following code to your site:

add_action('pre_get_posts', 'citygov_remove_filter_for_events');
function citygov_remove_filter_for_events($query) {
    if($query->get('post_type') == 'espresso_events') {
        remove_filter('posts_where', 'citygov_query_posts_where', 10);
    }
}

You can add the above to a functions plugin by following this guide.


presleydesign

November 22, 2019 at 8:47 am

Worked like a charm. Thank you!


Josh

  • Support Staff

November 22, 2019 at 10:16 am

You’re most welcome.

Viewing 5 reply threads

The support post ‘404 Page for Sold Out Events’ 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