Here’s are wp_query args:
$args = array(
'post_type' => 'sportpages'
,'post_status' => 'publish'
,'posts_per_page' => 1000
,'post_parent' => 4738
,'meta_query' => array(
'relation' => 'OR'
,array(
'key' => 'ecpt_sportgender_2'
,'value' => 'Boys'
,'compare' => 'LIKE'
)
,array(
'key' => 'ecpt_sportgender_2'
,'value' => 'Both'
,'compare' => 'LIKE'
)
)
);
My results are odd. I’m getting only the posts for Boys unless I swap Boys for Girls, in which case I get Girls. The only way to get “Both” is to make it get ONLY Both, and not do the relationship.
The order in which I put them in there makes no difference.
What am I missing?
You’ll probably need to do one of the following
'compare' => '='
(or leave it out, as it’s the default)'value' => $wpdb->esc_like( '%Boys%' )
(needsglobal $wpdb;
)'value' => $wpdb->esc_like( 'Boys' )
(needsglobal $wpdb;
)I figured out my problem. The query WAS returning the proper results, but the results were getting munged in some later code. 🙁
Thanks for your time pondering this.