I am working on a custom wordpress theme and have a pretty good grip on php & MySQL but less so on wordpress API so I’m wondering if one of you lovely people can help me out. Essentially I have this query:
$args = array(
'post_type' => 'any',
'orderby' => 'post_date',
'posts_per_page' => '3',
'post_status' => 'publish',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'catwalk_reports_feature_on_home_page',
'value' => '1',
'compare' => '='
),
array(
'key' => 'product_service_feature_on_home_page',
'value' => '1',
'compare' => '='
),
array(
'key' => 'wedding_tips_feature_on_home_page',
'value' => '1',
'compare' => '='
),
),
);
$the_query = new WP_Query( $args );
Which fails !:(
This seems to be because I have 3 arrays, when the query is performed like so:
$args = array(
'post_type' => 'any',
'orderby' => 'post_date',
'posts_per_page' => '3',
'post_status' => 'publish',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'catwalk_reports_feature_on_home_page',
'value' => '1',
'compare' => '='
),
array(
'key' => 'product_service_feature_on_home_page',
'value' => '1',
'compare' => '='
),
),
);
$the_query = new WP_Query( $args );
No errors, everything works as expected….
Any ideas?
Thanks in advance;
can you try it this way: