WP_Query sorting by meta_key, excluding some posts
-
When I sort my WP_Query with meta_key, if a post doesn’t have that meta key set it doesn’t show up in the results..
my_meta_value
=1
(or)0
(or) !isset()ie:
$q = new WP_Query(array('orderby'=>'meta_value','meta_key'=>'my_meta_value'))
returns only 3 results (three with
my_meta_value
set),$q = new WP_Query(array('orderby'=>'meta_value'))
returns 20 results (what I expect). but is not ordered properly
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP_Query sorting by meta_key, excluding some posts’ is closed to new replies.