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!
© 2023 Advanced Custom Fields.