[Resolved] Sorting posts based on custom date field is incorrect
This thread is resolved. Here is a description of the problem and solution.
Problem:
View not sorting by date correctly. Solution:
In this user's case they have the Post Order plugin installed. This plugin is known to disrupt the sorting order of our Toolset plugins so it is recommended to keep it disabled.
This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
We have a CPT "Webinar" with a custom date-time field "Webinar Date". hidden link
Our view selects all "past" webinars based on Webinar Datum v2 is a number lower than TODAY() which works, but the order is off
"Order by - Field - Webinar Datum v2 - Descending"
I expect the most recent "past" webinar to be first and then descend to the oldest webinar at the end.
However, the webinars ASCEND in time (feb -> march -> april). Except the second to last is indeed older than the 3rd last and the last one is absolutely the oldest, but that contradicts the sorting of the first 20 webinars.
It absolutely makes no sense.
When doing the sort order please ensure that you've set the order for the field to a number. Also if you're not running the latest version of our Toolset plugins I would recommend performing an update as well.
If the issue still persist then please go ahead and disable all the non-toolset plugins as well because any plugin that is affecting the post order in general will affect our View/Blocks ordering.
Should the issue still remain, please provide me with admin access to the site as well as a link to the page. I may need to grab a copy of the site if i'm unable to determine what is wrong from looking at the live site.
Usually this is suspected plugin. This plugin usually is the cause of when the sort order isn't sorting correctly.
So I would recommend keeping this plugin disabled as it doesn't scope its Ordering function but rather modify all the wordpress post queries with their custom ordering.