WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Custom Taxonomies: “Invalid Taxonomy” error and filtering problem

[Resolved] Custom Taxonomies: “Invalid Taxonomy” error and filtering problem

  • Just in case anyone else is having the same problem I just spent the last 7 hours on, I thought I’d share this on the forum.

    I created a CUSTOM TAXONOMY in my functions.php for “Industries”:

    function create_my_taxonomies() {
    	register_taxonomy(
    		'industries',
    		'post',
    		array(
    			'hierarchical' => false,
    			'label' => 'Industries',
    			'query_var' => true,
    			'rewrite' => true
    		)
    	);
    }
    add_action('init', 'create_my_taxonomies', 0);

    but two things were not working correctly:

    1) When editing a post, clicking the “Choose from the most used tags in Industries” link showed “Invalid Taxonomy”.

    2) When viewing the “Industry” page that shows all the terms for that taxonomy, and the number of posts using each one.. clicking those count links goes to the list of posts (Edit Posts page) but failed to filter down to just posts with the term i had clicked. Instead it showed all posts.

    THE FIX:
    Finally i realized that, in my original code in functions.php, the Taxonomy Name (the first argument) must be all LOWERCASE! I had used initial caps (“Industries”).

    That’s probably obvious to most people, but I missed it. Hopefully this will help if you did too.

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Custom Taxonomies: “Invalid Taxonomy” error and filtering problem’ is closed to new replies.