php - WordPress meta_query syntax issue -
can work out why following syntax work:
$results_args = array( 'post_type' => 'event', 'meta_key' => 'start_date', 'meta_value' => '20161227', 'posts_per_page' => 30 ); $results = new wp_query($results_args);
but following syntax not?
$results_args = array( 'post_type' => 'event', 'meta_query' => array( array( 'key' => 'start_date', 'value' => '20161227', 'compare' => '=', ), ), ); $results = new wp_query($results_args);
the latter code returns posts post_type = 'event'
.
docs @ https://codex.wordpress.org/class_reference/wp_query#custom_field_parameters.
i'm looking add multiple meta queries in, need latter syntax work.
any appreciated.
thanks,
jamie
Comments
Post a Comment