Home › Forums › Front-end Issues › Sorting by date › Reply To: Sorting by date
Ah!
Also, check that you don’t have any ‘pre_get_post’ filters that are modifying the args
That put me int he right direction. none of the other orderby arguments seem to work.
I changed up the query to:
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => '-1',
'meta_key' => 'date_received',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
remove_all_filters('posts_orderby');
$query = new WP_query($args);
And that fixed it. If this was in the documentation, my apologies for not seeing it. Either way, I’m good to go and thank you for your help.
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.