Home › Forums › Front-end Issues › WP_query to order by custom field › Reply To: WP_query to order by custom field
If your figures connected to taxonomies, then you can filter by tax_query
Your query has to look like this:
// filter on figures from serie's taxonomy
$args = array(
'post_type' => 'figure',
'posts_per_page' => -1,
'meta_key' => 'release_date_fr',
'orderby' => 'meta_value',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'serie', // taxonomy name
'field' => 'slug', // term_id, slug or name
'terms' => array( 'the-legend-of-zelda', 'hyrule-warriors' ), // single value or array of term id(s), term slug(s) or term name(s)
)
)
);
// query the figures
$the_query = new WP_Query($args);
BTW: If there is a error 500, then there is a new entry in you error logs, with more details about the error. Always start at this point to look for a solution.
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.