mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 14:14:36 +00:00
Query: Avoid PHP notice in get_queried_object() when query contains NOT EXISTS tax query.
Props johnjamesjacoby. See #37962. git-svn-id: https://develop.svn.wordpress.org/trunk@38585 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -118,6 +118,25 @@ class Tests_Query extends WP_UnitTestCase {
|
||||
unset( $q->query_vars['wptests_tax'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 37962
|
||||
*/
|
||||
public function test_get_queried_object_should_return_null_for_not_exists_tax_query() {
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
$q = new WP_Query( array(
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wptests_tax',
|
||||
'operator' => 'NOT EXISTS',
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
$queried_object = $q->get_queried_object();
|
||||
$this->assertNull( $queried_object );
|
||||
}
|
||||
|
||||
public function test_orderby_space_separated() {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user