What’s wrong with this meta query? (order by meta key, then title, doesn’t work)


Here’s my meta query:

$taxonomy_term = 1494;
$args['meta_query'] = array(
        'relation' => 'OR',
        'mp_exists' => array(
            'key' => 'tdlrm_mp_'.$taxonomy_term,
            'type' => 'NUMERIC',
        'mp_not_exists' => array(
            'key' => 'tdlrm_mp_'.$taxonomy_term,
            'compare' => 'NOT EXISTS'
$args['orderby'] = array( 'meta_value_num' => 'ASC', 'title' => 'ASC' );

The posts where 'tdlrm_mp_'.$taxonomy key exists get placed first as expected. Hovewer, the rest do not get ordered by their title (actually, I can’t figure out what they are ordered by). What am I doing wrong?

This answer doesn’t help. I wrote my query according to this manual.

Artem 1 year 2021-09-22T23:03:03-05:00 0 Answers 0 views 0

Leave an answer