Add a $default argument to get_query_var() and WP_Query::get(). fixes #16471.

git-svn-id: https://develop.svn.wordpress.org/trunk@27304 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2014-02-26 23:57:10 +00:00
parent 56c79f659c
commit 88f1b6e7ec
2 changed files with 20 additions and 7 deletions

View File

@@ -77,4 +77,14 @@ class Tests_Query extends WP_UnitTestCase {
$this->assertEquals( get_the_ID(), $post_id );
}
}
/**
* @ticket 16471
*/
function test_default_query_var() {
$query = new WP_Query;
$this->assertEquals( '', $query->get( 'nonexistent' ) );
$this->assertFalse( $query->get( 'nonexistent', false ) );
$this->assertTrue( $query->get( 'nonexistent', true ) );
}
}