mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Allow is_tag() to accept term_id, slug, 'term_name or array of any. Many other is_*()` funcs already do this. Adds unit tests.
Props ramiy. Fixes #18746. git-svn-id: https://develop.svn.wordpress.org/trunk@25287 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -428,9 +428,20 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
|
||||
function test_tag() {
|
||||
$this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
|
||||
$term_id = $this->factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );
|
||||
$this->go_to('/tag/tag-a/');
|
||||
$this->assertQueryTrue('is_archive', 'is_tag');
|
||||
|
||||
$tag = get_term( $term_id, 'post_tag' );
|
||||
|
||||
$this->assertTrue( is_tag() );
|
||||
$this->assertTrue( is_tag( $tag->name ) );
|
||||
$this->assertTrue( is_tag( $tag->slug ) );
|
||||
$this->assertTrue( is_tag( $tag->term_id ) );
|
||||
$this->assertTrue( is_tag( array() ) );
|
||||
$this->assertTrue( is_tag( array( $tag->name ) ) );
|
||||
$this->assertTrue( is_tag( array( $tag->slug ) ) );
|
||||
$this->assertTrue( is_tag( array( $tag->term_id ) ) );
|
||||
}
|
||||
|
||||
// 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
|
||||
|
||||
Reference in New Issue
Block a user