﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
18401,Passing array as 'value' to 'meta_query' yields failed SQL request,Doggie52,,"Say I have a custom post type called 'review' and it has a custom field called 'score'. The one and only 'review' has a 'score' of 3. The following code will output a $posts object with that 'review'.

{{{
$args = array('post_type' => 'review');
$args['meta_query'] = array(
	array(
	'key' => 'score',
	'value' => 3
));
$posts = new WP_Query($args);
}}}
SQL request made:
{{{
SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1  AND wp_posts.post_type = 'review' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'score' AND CAST(wp_postmeta.meta_value AS CHAR) = '3') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
}}}

When passing an array with that '4', however, it does something out of the ordinary. The $posts object does not contain a post, and look at the SQL request around ''wp_postmeta.meta_value''.
{{{
$args = array('post_type' => 'review');
$args['meta_query'] = array(
	array(
	'key' => 'score',
	'value' => array(3)
));
}}}
SQL request:
{{{
SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1  AND wp_posts.post_type = 'review' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'score' AND CAST(wp_postmeta.meta_value AS CHAR) = '') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
}}}

I apologize if the Component marked is incorrect, I was unable to find something that fit good enough.",defect (bug),closed,normal,,General,3.2.1,normal,duplicate,,Doggie52
