Home › Forums › General Issues › WP_Query orderby date field does not work › Reply To: WP_Query orderby date field does not work
I found the problem and resolved it.
I was using a plugin which re-order the post-type I tried to call.
This plugin is called Reorder-Post-Type.
It seems to apply a filter on all queries that concerns a post-type affected by the plugin, even in your own code.
If you want to prevent that, there’s a parameter that you can add in your query args, called ignore_custom_sort => true, like this :
$args = array(
'posts_per_page' => -1,
'post_type' => 'post',
'order' => 'DESC',
'ignore_custom_sort' => true,
'meta_key' => 'your_custom_field',
'orderby' => 'meta_value'
);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.