In WP_Meta_Query, interpret 'value' correctly when used with EXISTS/NOT EXISTS.

As in earlier versions, EXISTS with a value is equivalent to '=', while NOT
EXISTS should always ignore 'value'.

Props barrykooij.
Fixes #30681 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@30846 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2014-12-14 19:00:31 +00:00
parent 91ac188a12
commit 093de0f0be
2 changed files with 76 additions and 0 deletions
+11
View File
@@ -1419,6 +1419,17 @@ class WP_Meta_Query {
$where = $wpdb->prepare( '%s', $meta_value );
break;
// EXISTS with a value is interpreted as '='.
case 'EXISTS' :
$meta_compare = '=';
$where = $wpdb->prepare( '%s', $meta_value );
break;
// 'value' is ignored for NOT EXISTS.
case 'NOT EXISTS' :
$where = '';
break;
default :
$where = $wpdb->prepare( '%s', $meta_value );
break;