I get the posts but they are not sorted by 'sort' values. What's wrong with the following code?

$args['meta_query'] = array(
    'relation'  => 'AND',
    'cast'      => array( 
        'key'       => 'cast',
        'value'     => $cast, 
        'compare'   => 'LIKE'
    'director'  => array(
        'key'       => 'director',
        'value'     => $director,
        'compare'   =>'='
    'sort'      => array(
        'key'       => 'score',
        'compare'   =>'EXISTS'
$args['orderby'] = array( 'sort' => 'DESC' );

1 Answer 1


Problem Fixed!

there was an issue in input of post_meta_field.

after updating post, problem fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.