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

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -