We have a custom field called "Cruise Start Date" of the field type "date".
The view is set to display search results sorted by "Cruise Start Date" in ascending order and yet the search results are not sorting in this manner. Yet, when we set this search up they were. Can you offer any direction or guidance? Thank you.
I cannot replicate the issue.
I made a short video here of what I tried:
hidden link
I see you use several other plugins, have you tried without them?
There may be a conflict introduced.
Or, I miss a step or detail.
Please let me know if the Video's content corresponds to what you try.
If it does as well not help to re-save or eventually duplicate and apply a new view, after all other steps above, please let us know
Thank you. Yes, these are the steps we used to create our view. The view has been live for months. Oddly, it stopped working with the last Toolset update.
Hi, please try the following troubleshooting steps first:
- Temporarily activate the default Twenty Seventeen theme, deactivate all plugins except Types and Views, and test the View again.
- If the problem is resolved, reactivate your theme and plugins one by one until the problem returns.
- If the problem is not resolved, please take a screenshot of the View editor in wp-admin so I can see the Query Filter configurations.
Let me know what you find out and we can go from there.
Hi!
Yes, thank you we already ran through theme and plugin conflicts.
I attached a screenshot and very much appreciated your help!
Okay thanks for the additional information. I don't see anything in this View's setup that would indicate a problem. Can you show me how the View is inserted on this page? For instance, it could be inserted with a shortcode like this that overrides the order-by configurations:
[wpv-view name="your-view-slug" orderby="title"]
If you do not see the "orderby" attribute, try to turn off caching for this View by adding the cached="off" attribute like this:
[wpv-view name="your-view-slug" cached="off"]
Check the results to see if it makes any difference.
If neither seems to be the issue in your case, please turn on debugging temporarily by going to Toolset > Settings > Frontend Content > Debug mode. Reload the page where this View is displayed, and you should see a popup appear. If you do not, check your browser's popup settings and allow popups for this page. Reload to see the popup. Use the "Show" buttons to toggle open all sections of this View debug popup, then copy + paste the full contents here for me to review. After that, you can turn off debug mode again.
Thank you, yes, we do have inserted as:
[wpv-view name="cruise-search" cached="off"]
Thank you, here you go!
Page info
Current page hidden link
Total memory used 5.7851MB
Render time 1.59
Total MySQL queries 123
CPU usage 1.57%
Elements info
- Cruise Search (Cruise Itineraries ordered by Field - wpcf-cruise-start-date, ascending)
ID 16855
Name Cruise Search (Edit)
Kind of element View
Render time 0.28654
Memory used 0.6862MB
Summary Cruise Itineraries ordered by Field - wpcf-cruise-start-date, ascending
Query args Hide
Basic query arguments
Array
(
[post_type] => Array
(
[0] => cruise-itinerary
)
[paged] => 1
[suppress_filters] =>
[ignore_sticky_posts] => 1
)
MySQL query Hide
SELECT wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND wp_posts.ID NOT IN (17241) AND (
wp_term_relationships.term_taxonomy_id IN (369)
) AND (
wp_postmeta.meta_key = 'wpcf-cruise-start-date'
) AND wp_posts.post_type = 'cruise-itinerary' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order, wp_postmeta.meta_value+0 ASC
... truncated by admin for readability ...
The post queries indicate the problem is the posts are being ordered primarily by menu_order, and secondarily by the custom field date:
SELECT wp_posts.* FROM wp_posts ... ORDER BY wp_posts.menu_order, wp_postmeta.meta_value+0 ASC
That's not normal, and I would usually suspect a theme or plugin of injecting this additional ORDER BY clause. However, you said that you tested and saw the same results without your theme and other plugins active. So I'll need to take a closer look here and see what's going on. I would like to create a clone of your site so I can run some tests locally without disturbing the live site. I can install the Duplicator Pro plugin to create that clone and get started testing. If that's okay, please provide login credentials in the private reply fields here.
OH Yikes!!!! I did not look at that query hard enough and we have a custom function that we use for custom sorting. Ughhhh. Thanks. Issue solved!!