id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 22096 IN meta_query with empty array as meta_value results in invalid database query batmoo wonderboymusic "If you do an {{{IN}}} meta_query and pass in an empty array to the {{{value}}}, the {{{INNER JOIN}}} clause for the postmeta table isn't added, which results in an invalid query: {{{ new WP_Query( array( 'meta_query' => array( array( 'key' => 'abc', 'value' => array(), 'compare' => 'IN' ) ) ) ); }}} This results in an error like so: {{{ WordPress database error: [Unknown column 'wp_postmeta.meta_key' in 'where clause'] SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND (wp_postmeta.meta_key = 'abc' ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 5 }}}" defect (bug) closed normal 3.6 Query 3.1.3 normal fixed has-patch