404 error with some past event archive pages
-
Using a link checker on a small site with 24 events total, I’m seeing 404 errors for 565 links on 16,004 pages, and they’re all \related to various TEC archive pages, with some bizarre behavior. Here’s an example. Go to this page:
https://linncountyswa.com/events/list/page/3/?eventDisplay=past
To the left of the Today button, click the Left Arrow, which takes you to the previous set of past events–it’s got ‘/page/4/’ in the URL. It displays some events, right?
Now refresh the page in your browser. Now you get a 404 error. But it’s the identical link.Another example: Go to https://linncountyswa.com/events/list/page/3/?tribe-bar-date=2021-08-15 . Click the right arrow (Next events) to get to page/4/, then reload the browser page.
Installation:
TEC Version 6.0.6.2. I had updated the database after installing.
The Events Calendar: Category Colors: v 7.1.1
WP v 6.1.1
PHP v 7.4.33
Beaver Builder Theme 1.7.12.1 + child themeTroubleshooting steps, with no success:
After each attempt I purged the hosting server’s dynamic cache (SIteground) and shift-reloaded the browser page.
1. Flushed the permalinks.
2. Deactivated all plugins except TEC.
3. Switched to generic WP theme.
4. Deleted all transients.
5. Bulk-resaved all the events. (There are only 24)
6. Pasted the code from https://gist.github.com/elimn/d3483854e8e9399e449e into my child theme’s functions.php file in case that helps you troubleshoot.What SEEMED like it must be the problem, but…
I found some old code in my child theme that I’d added a year and a half ago to circumvent a Beaver Builder bug in one of their modules that was not displaying a list of events properly. Surely, I thought, that must be the problem. But removing the code didn’t have any effect on this issue (and the code is permanently removed now). Here’s the code snippet though–perhaps something is still lurking in the events that was caused by this code?// Fix for Events Calendar showing past events in BB Posts module // Requires adding custom-posts ID to module /* function get_events_meta_query( $show_events = [] ) { $local_time = current_datetime(); $current_timestamp = $local_time->getTimestamp() + $local_time->getOffset(); $today = gmdate( 'Y-m-d 00:00:00', $current_timestamp ); $current_time = gmdate( 'Y-m-d H:i:s', $current_timestamp ); $queries = []; foreach ( $show_events as $event ) : if ( 'today' === $event ) { $queries[] = array( 'relation' => 'AND', array( 'key' => '_EventStartDate', 'compare' => '<=', 'value' => $today, 'type' => 'DATE', ), array( 'key' => '_EventEndDate', 'compare' => '>=', 'value' => $today, 'type' => 'DATE', ), ); } elseif ( 'past' === $event ) { $queries[] = array( 'key' => '_EventEndDate', 'compare' => '<', 'value' => $current_time, 'type' => 'DATETIME', ); } elseif ( 'future' === $event ) { $queries[] = array( 'key' => '_EventEndDate', 'compare' => '>', 'value' => $current_time, 'type' => 'DATETIME', ); } endforeach; $meta_query = array(); if ( count( $show_events ) > 1 ) { $meta_query['relation'] = 'OR'; } foreach( $queries as $query ) { $meta_query[] = $query; } return $meta_query; } add_filter( 'fl_builder_loop_query_args', function( $args ) { if ( 'custom-posts' === $args['settings']->id ) { $args['meta_query'] = get_events_meta_query( array( 'today', 'future' ) ); } return $args; } ); */
There is no Beaver Themer layout controlling the archive area of the page that displays events, nor
Thanks for whatever ideas you might have.
The page I need help with: [log in to see the link]
- The topic ‘404 error with some past event archive pages’ is closed to new replies.