Home Forums Event Espresso Premium 404 error for event page when event is sold out

404 error for event page when event is sold out

Posted: February 23, 2021 at 12:45 pm


February 23, 2021 at 12:45 pm

Hi, I have 15 events currently active and two of them have just sold out, however, I now get 404 errors when clicking on the event to view the event details page. I’ve seen this topic posted on the support forum but without a clear resolution that I can follow. My website events page is and the two events that show a 404 error are “VIRTUAL CPS EDUCATION: BENEFITS & CHALLENGES” and “WHAT’S NEW IN TEEN DRIVER SAFETY”. The events that are not sold out do not have this error. Would you please help me to get this fixed? Thanks in advance.


  • Support Staff

February 24, 2021 at 6:20 am

Hi there,

Usually, this means that the theme (possibly a plugin, but generally the theme) is checking specifically for ‘published’ posts and wont display any other.

Can you send me a copy of the theme so I can check if I get the same locally and see if there is a hook you can use to fix this?

Either add a link we can use to download the theme here or send it support[at] (you may need to use something like WeTransfer if the filesize is above 10MB).


February 24, 2021 at 7:28 am

This reply has been marked as private.


  • Support Staff

February 24, 2021 at 8:02 am

Thanks, just noting that I’ve set your reply to private simply because it contains a download link.

I’ve now downloaded the theme, you can remove those files if you wish.

Looking now.


February 24, 2021 at 8:07 am

Thank you. I will remove the file now.


  • Support Staff

February 24, 2021 at 8:35 am

Yeah, that’s exactly what they are doing.


// Pre query: Add filter to main query
if ( !function_exists( 'royal_event_query_posts_where' ) ) {
	// Handler of add_filter('posts_where', 'royal_event_query_posts_where', 10, 2);
	function royal_event_query_posts_where($where, $query) { 
		global $wpdb; 
		if (is_admin() || $query->is_attachment) return $where;
		if (royal_event_strpos($where, 'post_status')===false && (!isset($_REQUEST['preview']) || $_REQUEST['preview']!='true') && (!isset($_REQUEST['vc_editable']) || $_REQUEST['vc_editable']!='true')) {
			if (current_user_can('read_private_pages') && current_user_can('read_private_posts'))
				$where .= " AND ({$wpdb->posts}.post_status='publish' OR {$wpdb->posts}.post_status='private')";
				$where .= " AND {$wpdb->posts}.post_status='publish'";
		return $where;

This means your site can’t use custom a post_status as EE does.

You can remove that code specifically for EE events using something like this:

Add that to a custom functions plugin, we have some documentation on creating one here:


February 24, 2021 at 8:44 am

Thank you so much. That solved my problem. I very much appreciate your quick replies!!


  • Support Staff

February 24, 2021 at 8:50 am

You’re most welcome 🙂

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


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