Taxonomy: Correct `WP_Error` usage in `WP_Tax_Query::clean_query()` and `WP_Tax_Query::transform_query()`.

Fixes #37389.

git-svn-id: https://develop.svn.wordpress.org/trunk@38079 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2016-07-17 16:32:50 +00:00
parent 59f15cdea9
commit ad30724bb5
1 changed files with 3 additions and 3 deletions

View File

@ -562,14 +562,14 @@ class WP_Tax_Query {
private function clean_query( &$query ) {
if ( empty( $query['taxonomy'] ) ) {
if ( 'term_taxonomy_id' !== $query['field'] ) {
$query = new WP_Error( 'Invalid taxonomy' );
$query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
return;
}
// so long as there are shared terms, include_children requires that a taxonomy is set
$query['include_children'] = false;
} elseif ( ! taxonomy_exists( $query['taxonomy'] ) ) {
$query = new WP_Error( 'Invalid taxonomy' );
$query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
return;
}
@ -655,7 +655,7 @@ class WP_Tax_Query {
}
if ( 'AND' == $query['operator'] && count( $terms ) < count( $query['terms'] ) ) {
$query = new WP_Error( 'Inexistent terms' );
$query = new WP_Error( 'inexistent_terms', __( 'Inexistent terms.' ) );
return;
}