Home › Forums › Front-end Issues › Date orderby is not working › Reply To: Date orderby is not working
Well I figured it out but I had to add remove_all_filters('posts_orderby');
before the $args and had to change order
to DESC
because remove filters reversed the order. Something odd is happening but if someone has an explaination as to why this works please let me know.
remove_all_filters('posts_orderby');
$args = array (
'post_type' => 'exhibitions',
'meta_query'=> array(
'relation' => 'AND',
array(
'key' => 'exhibition_status',
'value' => 'current',
),
array(
'key' => 'end_date',
'compare' => 'EXISTS',
),
),
'meta_key' => 'end_date',
'orderby' => 'meta_value',
'order' => 'DESC',
'post_status' => 'publish',
'posts_per_page' => 10,
'paged' => get_query_var( 'paged' ),
);
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.