WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13044 closed defect (bug) (invalid)

is_taxonomy should return true on taxonomy pages

Reported by: thomask Owned by: filosofo
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords: reporter-feedback
Focuses: Cc:

Description

contrary is_category() and other conditional functions, the is_taxonomy function must have argument $taxonomy, so cannot be used to check if i am on the taxonomy page.

wp-includes/taxnomoy.php should have something like

function is_taxonomy( $taxonomy= NULL ) {
        global $wp_query;
        if (NULL == $taxonomy) return isset($wp_query->is_tax);
	global $wp_taxonomies;
	return isset($wp_taxonomies[$taxonomy]);
}

Change History (2)

comment:1 nacin4 years ago

  • Keywords reporter-feedback added

We already have is_taxonomy().

For something to work in the loop, you may be thinking of is_tax() (which does *not* return true for post_tag and category due to compat reasons -- #11904).

comment:2 dd324 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed

closing as invalid.

is_taxonomy() should be used to check if a taxonomy is registered, is_tax() should be used to tell if its a taxonomy page.

Note: See TracTickets for help on using tickets.