Closed janboddez closed 2 months ago
By reassigning $query, you break most that comes after.
$query
Also, current( $query->query_vars['meta_query'] ) can return a string ... See the example in the docs, where current( $query->query_vars['meta_query'] ) would return 'AND':
current( $query->query_vars['meta_query'] )
'AND'
$args = array( 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'featured', 'value' => '1' ), array( 'key' => 'buried', 'value' => '1', 'type' => 'numeric', 'compare' => '!=' ) ) );
But in general, $query, which is passed to the callback by reference, should not be reassigned.
Oh, seems that we both did that in parallel :)
By reassigning
$query
, you break most that comes after.Also,
current( $query->query_vars['meta_query'] )
can return a string ... See the example in the docs, wherecurrent( $query->query_vars['meta_query'] )
would return'AND'
:But in general,
$query
, which is passed to the callback by reference, should not be reassigned.