Hello, I hope you are doing well.
I had an issue with the previous event link on my website, the issue was that the previous link was “looping” between two events from the same day. I found out how to fix it but I wanted to let you know so you can investigate.
– The WordPress timezone is set to Los Angeles
– Function: get_event_link() in Tribe/Main.php
– $post->EventStartDate is set to “2015-12-02 23:00:00”
– in the DB, _EventStartDate is set to “2015-12-02 15:00:00”
– in the DB, _EventStartDateUTC is set to “2015-12-02 23:00:00”
The issue is that the query needs to compare $post->EventStartDate with _EventStartDateUTC and not _EventStartDate. I fixed the issue by changing to following code:
$args = array(
'post__not_in' => array( $post->ID ),
'order' => $order,
'orderby' => "TIMESTAMP( $wpdb->postmeta.meta_value ) ID",
'posts_per_page' => 1,
'meta_query' => array(
array(
'key' => '_EventStartDateUTC',
'value' => $post->EventStartDate,
'type' => 'DATETIME',
'compare' => $direction,
),
array(
'key' => '_EventHideFromUpcoming',
'compare' => 'NOT EXISTS',
),
'relation' => 'AND',
),
);
Let me know if it helps.
Thank you,
Matt