php - orderby 'meta_value_num' is breaking my WP_Query

I'm having an issue when trying to order myWP_Query
by a numeric ACF field. I've seen a few similar posts on here but none have been able to to help me resolve me issue.
Here are the args to my query:
$args = array (
'post_type' => 'kb',
'post_status' => 'publish',
'meta_key' => 'order_in_list',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'tax_query' => array (
array (
'taxonomy' => 'product',
'field' => 'term_id',
'terms' => $cat->term_id,
)
),
);
order_in_list
is the name of an ACF number field that exists on all posts of type 'kb'.
The above query currently returns nothing, however if I comment out themeta_key
line in theargs
, it works fine. Does anyone have any idea what I'm doing wrong here?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: invalid argument supplied for foreach() laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.