Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#13044 closed defect (bug) (invalid)

is_taxonomy should return true on taxonomy pages

Reported by: thomask's profile thomask Owned by: filosofo's profile 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)

#1 @nacin
15 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).

#2 @dd32
15 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.