Way to include posts both with & without certain meta_key in args for wp_query?
EDIT 2: Rather than figuring out the real solution I’ve decided to use a workaround, and am simply setting the default value for book_in_series to ‘0’. Thanks to @eddiemoya for all his the time he spent looking at this with me!
EDIT: I had a different question with required posting the full code for this archive page / query, if you’d like to see that it’s here.
This query is working great, but doesn’t include any posts which don’t have the meta_key ‘book_in_series’ (which determines the sort value). What I’d like to have happen is for the books to be sorted by this value if it exists, otherwise come back unordered. Is that possible?
$args = array( 'post_type' => 'books', 'posts_per_page' => -1, 'nopaging' => true, 'surpress_filters' => true, 'orderby' => 'meta_value', 'meta_key' => 'book_in_series', 'order' => 'ASC', 'post_parent' => $current_series_id, ); $books = new WP_Query( $args);
It seems like this answer from Rarst comes close, but I’m not sure how to adapt it for my circumstances. Custom query with query_posts doesn’t show post without certain meta_key
Thanks in advance for your help!