Home › Forums › Calendar Products › Events Calendar PRO › Events Calendar changing sort order of tag archives
- This topic has 14 replies, 5 voices, and was last updated 5 years, 10 months ago by Kevin.
-
AuthorPosts
-
January 7, 2018 at 8:23 am #1419909KevinParticipant
The latest updates to the Events Calendar is affecting the sort order of our WordPress tag archives.
Normally, tag archives in WordPress appear in reverse chronological order. Updates to Events Calendar 4.6.8 and Events Calendar Pro 4.4.20.1 causes this issue.
It could be either one of these plugin updates causing the issue and the plugin should definitely not be affecting WordPress in this way. It looks like there were SQL changes in Pro 4.4.20 that are likely causing this and should have been tested more.
Here are query monitor results for the main query on a tag archive page.
Prior to plugin update (sort order is correct, events calendar 4.6.7, events calendar pro 4.4.19):
SELECT SQL_CALC_FOUND_ROWS *
FROM (
SELECT DISTINCT gw_wp_posts.*, IF (gw_wp_posts.post_type = 'tribe_events', gw_wp_postmeta.meta_value, gw_wp_posts.post_date) AS EventStartDate
FROM gw_wp_posts
LEFT JOIN gw_wp_term_relationships
ON (gw_wp_posts.ID = gw_wp_term_relationships.object_id)
LEFT JOIN gw_wp_postmeta as gw_wp_postmeta on gw_wp_posts.ID = gw_wp_postmeta.post_id
AND gw_wp_postmeta.meta_key = '_EventStartDate'
WHERE 1=1
AND ( gw_wp_term_relationships.term_taxonomy_id IN (638) )
AND gw_wp_posts.post_type IN ('post', 'tribe_events')
AND (gw_wp_posts.post_status = 'publish'
OR gw_wp_posts.post_status = 'acf-disabled'
OR gw_wp_posts.post_status = 'tribe-ea-success'
OR gw_wp_posts.post_status = 'tribe-ea-failed'
OR gw_wp_posts.post_status = 'tribe-ea-schedule'
OR gw_wp_posts.post_status = 'tribe-ea-pending'
OR gw_wp_posts.post_status = 'tribe-ea-draft'
OR gw_wp_posts.post_status = 'private')
ORDER BY post_date DESC ) a
GROUP BY IF( post_parent = 0, ID, post_parent )
ORDER BY EventStartDate DESC
LIMIT 0, 30After updated to Events Calendar 4.6.8 and Events Calendar Pro 4.4.20.1 (sort order is incorrect. it is chronological, not reverse chronological)
SELECT SQL_CALC_FOUND_ROWS *
FROM (
SELECT DISTINCT gw_wp_posts.*, IF (gw_wp_posts.post_type = 'tribe_events', gw_wp_postmeta.meta_value, gw_wp_posts.post_date) AS EventStartDate
FROM gw_wp_posts
LEFT JOIN gw_wp_term_relationships
ON (gw_wp_posts.ID = gw_wp_term_relationships.object_id)
LEFT JOIN gw_wp_postmeta as gw_wp_postmeta on gw_wp_posts.ID = gw_wp_postmeta.post_id
AND gw_wp_postmeta.meta_key = '_EventStartDate'
WHERE 1=1
AND ( gw_wp_term_relationships.term_taxonomy_id IN (638) )
AND gw_wp_posts.post_type IN ('post', 'tribe_events')
AND (gw_wp_posts.post_status = 'publish'
OR gw_wp_posts.post_status = 'acf-disabled'
OR gw_wp_posts.post_status = 'tribe-ea-success'
OR gw_wp_posts.post_status = 'tribe-ea-failed'
OR gw_wp_posts.post_status = 'tribe-ea-schedule'
OR gw_wp_posts.post_status = 'tribe-ea-pending'
OR gw_wp_posts.post_status = 'tribe-ea-draft'
OR gw_wp_posts.post_status = 'private')
ORDER BY post_date DESC ) a
GROUP BY IF( post_parent = 0, ID, post_parent )
LIMIT 0, 30January 9, 2018 at 1:02 pm #1421772AndrasKeymasterHi Kevin,
Thanks for reaching out!
Is this influencing your non-event tag archives as well? Or only the event related tag archives?
If it’s influencing the non-event tag archives as well, then please check if you get the correct / desired order if you disable all the calendar plugins.
Meanwhile I’ll try to investigate this issue as well.
Cheers,
AndrasJanuary 24, 2018 at 10:04 am #1434872KevinParticipantWe were seeing on tags, not categories or home page archives.
Yes, sort order is correct without Events Calendar. And sort order is correct with previous versions of Events Calendar.
Notice the query changes shown above when your plugin was updated. Namely the removal of the eventstartdate order by statement
January 25, 2018 at 3:21 am #1435551AndrasKeymasterHi Kevin,
Thanks for getting back to me on that.
We have also received some other reports on this as well, we will look into this.
It would greatly help us if you could share your system information with us for the time being.
A workaround would be rolling back to TEC 4.4.19.
I am going to set the status of this ticket to “pending fix” and we will update it once the fix is released.
For any new questions or issues please create a new ticket and we’ll help you out.
Thanks and cheers,
AndrasFebruary 20, 2018 at 3:18 pm #1459231KevinParticipantHas this issue been fixed yet?
February 21, 2018 at 1:05 pm #1460315AndrasKeymasterHi Kevin,
Perfect timing! 🙂 I checked the status of the ticket and it looks like a fix has been developed recently. It is currently waiting to be tested thoroughly and if it passes then it will be probably released with our next Maintenance Release beginning of March. Only a little more to wait.
Cheers,
AndrasMarch 12, 2018 at 6:08 pm #1477095KevinParticipantI just updated to the latest maintenance release. It looks like this fix is still not in there? When can I expect it?
March 13, 2018 at 2:48 am #1477285AndrasKeymasterHi Kevin,
I checked the status of the ticket. It was planned to be released now but the developer working on it didn’t manage to fully finish it on time, so it had to be postponed to the next maintenance release of Events Calendar PRO.
The only workaround I can suggest until that comes is to roll back to PRO version 4.4.19.
I’m sorry about the delay and thanks for your patience!
Cheers,
AndrasApril 2, 2018 at 1:39 pm #1494697KevinParticipantDid this fix make it in by chance to the latest maintenance release?
April 2, 2018 at 3:37 pm #1494771BarryMemberHi Kevin,
I’m afraid it did not make it (and actually Events Calendar PRO was not included in our last round of updates).
https://gist.github.com/barryhughes/44a277f7472ba633db1ee2ea0f91c60f
You could try the above snippet, which could be added either to a custom plugin (preferred) or else to your theme’s functions.php file.
It might help as a temporary workaround until we do get an official release out (if it doesn’t you can simply remove it and wait on the substantive fix).
Thanks for your patience so far!
April 6, 2018 at 9:17 am #1498682KevinParticipantI attempted this fix and is does not work. Category archives appear in the correct order. The main query of a category archive looks like this:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (7486) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'tribe-ea-success' OR wp_posts.post_status = 'tribe-ea-failed' OR wp_posts.post_status = 'tribe-ea-schedule' OR wp_posts.post_status = 'tribe-ea-pending' OR wp_posts.post_status = 'tribe-ea-draft' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 30
Tag archives still appear in reverse order, and the sql for the main query looks like this:
SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT DISTINCT wp_posts.*, IF (wp_posts.post_type = 'tribe_events', wp_postmeta.meta_value, wp_posts.post_date) AS EventStartDate FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_postmeta as wp_postmeta on wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_EventStartDate' WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (1086) ) AND wp_posts.post_type IN ('post', 'tribe_events') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'tribe-ea-success' OR wp_posts.post_status = 'tribe-ea-failed' OR wp_posts.post_status = 'tribe-ea-schedule' OR wp_posts.post_status = 'tribe-ea-pending' OR wp_posts.post_status = 'tribe-ea-draft' OR wp_posts.post_status = 'private') ORDER BY EventStartDate DESC ) a GROUP BY IF( post_parent = 0, ID, post_parent ) LIMIT 0, 30
Since category and tags are both simply taxonomy queries, they should be the same. Any pointers here? I need this fix as I need the PHP 7.2 updates in recent updates to Events Calendar as well.
April 9, 2018 at 9:21 am #1500666AndrasKeymasterHi Kevin,
I’m sorry to hear that snippet didn’t do it.
I made a small tweak to the snippet Barry provided, you can find it here:
https://gist.github.com/andrasguseo/810b8d419e4c5f0ceb80135c90b78c5c
For now this is as much as we can do about it. If this doesn’t work and you need this functionality, then the workaround would be to roll back to the version of the plugins where it was still working.
We will definitely post an update here once a fix for the issue is released.
Cheers,
AndrasApril 26, 2018 at 9:33 am #1516943ISANSParticipantHi all. I was having the same issue and I just want to report that András’ fix worked for me. Thanks!
April 27, 2018 at 2:41 am #1517626AndrasKeymasterOh, Kristy, thanks for reporting that! Much appreciated and I’m super stoked to hear it works! Awesome!
Kevin, did you manage to give it a try? Would love to hear if it does the trick for you.
Cheers,
AndrasMay 9, 2018 at 5:36 pm #1526801VictorKeymasterHi Kevin and Kristy!
Just wanted to share with you that a new release of our plugins is out, including a fix for this issue 🙂
Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-6-may-2018/
We apologize for the delay and appreciate your patience while we worked on this.
Please update the plugins and let us know if the fix works for your site.
Best,
Victor -
AuthorPosts
- The topic ‘Events Calendar changing sort order of tag archives’ is closed to new replies.