Support » Alpha/Beta » is_taxonomy() does not recognize custom taxonomies

is_taxonomy() does not recognize custom taxonomies

  • WHen I have created a new taxonomy, then WordPress internal fuction is_taxonomy() does not recognize my taxonomy. This leads to a number of problems – for example, I cannot use wp_insert_term on wp_update_term on wp_set_post_terms

Viewing 4 replies - 1 through 4 (of 4 total)
  • I can verify that is_taxonomy() does in fact work on custom taxonomies. The issue that you are most likely experiencing is that you are calling the function too early. The following two examples should illustrate:

    add_action( 'init', 'is_there_a_doggie_treat_taxonomy', 0 );
    add_action( 'init', 'create_doggie_treat_taxonomy', 50 );
    add_action( 'init', 'is_there_a_doggie_treat_taxonomy', 100 );
    function is_there_a_doggie_treat_taxonomy() {
    	print ( is_taxonomy( 'doggie-treat' ) ) ? '<p>We Have Treats!</p>' : '<p>No Treats for you!</p>';
    function create_doggie_treat_taxonomy() {
    	register_taxonomy( "doggie-treat", 'post', array(
    		'hierarchical' => true,
    		'label' => 'Doggie Treats',
    		'singular' => 'Doggie Treat',
    		'update_count_callback' => $tax['update_count_callback'],
    		) );

    So, we’ve hooked into init 3 times. First we have checked to see if our taxonomy exists at 0. Unfortunately , it does not yet exist. At 50, we create the taxonomy and when we check for it again at 100, it is there.

    I would try hooking the function a little later.


    is_taxonomy() was deprecated, and completely removed, same goes for is_post_type()

    Now use these instead


    Here’s the trac ticket:

    Please, somebody help me?

    I’m having the same problem, using WP 3.0.1 …
    I have created a custom taxonomy, named “catalogo”, but when I try use print_r( get_categories('taxonomy=catalogo') ) or wp_list_categories('taxonomy=catalogo') … or when I simply try to check if taxonomy exists, I get an error “Invalid Taxonomy” …
    taxonomy_exists('catalogo') is returning false for me… Please.. What I did wrong?

    Thanks in advance.
    Miriam de Paula

    This post has been moved to a new topic where I can explain better:

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_taxonomy() does not recognize custom taxonomies’ is closed to new replies.