404 page displayed if no future events are loaded

Home Forums Calendar Products Events Calendar PRO 404 page displayed if no future events are loaded

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #941782
    saibotny
    Participant

    Plugin is updated, but still seeing the title of the page showing 404, if

    #941783
    saibotny
    Participant

    This reply is private.

    #941935
    Barry
    Member

    Hi saibotny,

    When a view has no events to display it will indeed return a 404 Not Found status and this is intentional – because nothing has been found that we can show to the user.

    That said, by itself our plugin does not add “Page not found” to the title tag or “Error 404 Page” as a title within the page itself – these are things that, in all likelihood, your theme is doing.

    It’s possible to stop list views from returning 404s, though – just add this short snippet to your theme’s functions.php file:

    add_action( 'tribe_events_parse_query', 'no_event_list_404s' );
    
    function no_event_list_404s( $query ) {
    	if ( $query->is_main_query() && $query->get( 'eventDisplay' ) == 'list' && ! $query->is_tax && ! $query->tribe_is_event_category ) {
    		$query->is_post_type_archive = true;
    		$query->queried_object       = get_post_type_object( TribeEvents::POSTTYPE );
    		$query->queried_object_id    = 0;
    	}
    }

    Does that help?

    #941952
    saibotny
    Participant

    Worked like a charm, thank you so much!

    #942047
    Barry
    Member

    Awesome 🙂

    I’ll close this topic in that case – but please don’t hesitate to post fresh questions should anything else crop up.

    Last but not least, if you have a moment to spare we’d love to hear your thoughts on The Events Calendar and if it’s suiting your needs over on our plugin review page.

    Thanks again!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘404 page displayed if no future events are loaded’ is closed to new replies.