Events Calendar changing sort order of tag archives

Home Forums Calendar Products Events Calendar PRO Events Calendar changing sort order of tag archives

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1419909
    Kevin
    Participant

    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, 30

    After 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, 30

    #1421772
    Andras
    Keymaster

    Hi 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,
    Andras

    #1434872
    Kevin
    Participant

    We 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

    #1435551
    Andras
    Keymaster

    Hi 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,
    Andras

    #1459231
    Kevin
    Participant

    Has this issue been fixed yet?

    #1460315
    Andras
    Keymaster

    Hi 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,
    Andras

    #1477095
    Kevin
    Participant

    I just updated to the latest maintenance release. It looks like this fix is still not in there? When can I expect it?

    #1477285
    Andras
    Keymaster

    Hi 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,
    Andras

    #1494697
    Kevin
    Participant

    Did this fix make it in by chance to the latest maintenance release?

    #1494771
    Barry
    Member

    Hi 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!

    #1498682
    Kevin
    Participant

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

    #1500666
    Andras
    Keymaster

    Hi 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,
    Andras

    #1516943
    ISANS
    Participant

    Hi all. I was having the same issue and I just want to report that András’ fix worked for me. Thanks!

    #1517626
    Andras
    Keymaster

    Oh, 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,
    Andras

    #1526801
    Victor
    Keymaster

    Hi 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

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Events Calendar changing sort order of tag archives’ is closed to new replies.