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

Question

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.

0
Artem 2 months 2021-09-22T23:03:03-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse