Prevent invalid queries in certain empty-array-passing meta_query cases.
fixes #22096. props wonderboymusic. git-svn-id: http://core.svn.wordpress.org/trunk@24563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
759298f8b8
commit
24ac7c4ac5
|
@ -678,7 +678,7 @@ class WP_Meta_Query {
|
|||
}
|
||||
|
||||
// WP_Query sets 'meta_value' = '' by default
|
||||
if ( isset( $qv[ 'meta_value' ] ) && '' !== $qv[ 'meta_value' ] )
|
||||
if ( isset( $qv[ 'meta_value' ] ) && '' !== $qv[ 'meta_value' ] && ( ! is_array( $qv[ 'meta_value' ] ) || $qv[ 'meta_value' ] ) )
|
||||
$meta_query[0]['value'] = $qv[ 'meta_value' ];
|
||||
|
||||
if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) {
|
||||
|
@ -714,6 +714,14 @@ class WP_Meta_Query {
|
|||
$key_only_queries = array();
|
||||
$queries = array();
|
||||
|
||||
// Split out the queries with empty arrays as value
|
||||
foreach ( $this->queries as $k => $q ) {
|
||||
if ( is_array( $q['value'] ) && empty( $q['value'] ) ) {
|
||||
$key_only_queries[$k] = $q;
|
||||
unset( $this->queries[$k] );
|
||||
}
|
||||
}
|
||||
|
||||
// Split out the meta_key only queries (we can only do this for OR)
|
||||
if ( 'OR' == $this->relation ) {
|
||||
foreach ( $this->queries as $k => $q ) {
|
||||
|
|
Loading…
Reference in New Issue