Support

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

Viewing 7 reply threads


tmcclure

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 http://www.lifesaversconference.org/events/ 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.


Tony

  • 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]eventespresso.com (you may need to use something like WeTransfer if the filesize is above 10MB).


tmcclure

February 24, 2021 at 7:28 am

This reply has been marked as private.


Tony

  • 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.


tmcclure

February 24, 2021 at 8:07 am

Thank you. I will remove the file now.


Tony

  • Support Staff

February 24, 2021 at 8:35 am

Yeah, that’s exactly what they are doing.

\royal-event\fw\core\core.wp.php

// 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')";
			else
				$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:

https://gist.github.com/Pebblo/4495f0e3957b2123c216e9d55121b658

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

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


tmcclure

February 24, 2021 at 8:44 am

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


Tony

  • Support Staff

February 24, 2021 at 8:50 am

You’re most welcome 🙂

Viewing 7 reply threads

The support post ‘404 error for event page when event is sold out’ 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