Custom Post Type UI
[resolved] Custom Taxonomies not showing in get_taxonomies (5 posts)

  1. campatsky
    Posted 2 years ago #

    I've created several taxonomies and when trying to actually access them in development, they don't seem to exist. For example, I created a custom taxonomy called interests. When I use $taxs = get_taxonomies(); var_dump($taxs); none of the custom taxonomies show up. When I try $terms = get_terms('interests'); var_dump($terms); I receive an error that says invalid taxonomy.

    It appears they are not actually being created, but in wordpress I see them in the manage taxonomies menu and I've created many tags in each of the custom taxonomies, and they are present in the pages/posts that they are assigned to. I am so lost as to why this is occurring. I would greatly appreciate any help!


  2. Michael Beckwith
    Plugin Author

    Posted 2 years ago #

    I'd try using the following example, including parameters http://codex.wordpress.org/Function_Reference/get_taxonomies#Output_a_list_all_registered_taxonomies

    Also make sure that you're trying to query for them with the taxonomy slug that you registered.

  3. campatsky
    Posted 2 years ago #

    Hi Michael, I tried all of the taxonomy outputs but only the built-in taxonomies are showing.

    these are the only taxonomies that appear:

    In the custom post ui manager i have 2 additional taxonomies - slugs: locations and interests. The locations taxonomy is accessible when i use get_terms('locations') but the terms/tags in interests is not accessible at all. I get an invalid taxonomy error. Neither appears when I output a list of all the registered taxonomies.

    I only registered them through custom post ui, do I need to register them manually in my functions.php file as well?

  4. campatsky
    Posted 2 years ago #

    Here is the code generated by the custom post ui:

    add_action('init', 'cptui_register_my_taxes_interests');
    function cptui_register_my_taxes_interests() {
    register_taxonomy( 'interests',array (
    0 => 'page',
    array( 'hierarchical' => true,
    'label' => 'Interests',
    'show_ui' => true,
    'query_var' => true,
    'show_admin_column' => true,
    'labels' => array (
    'search_items' => 'Interest',
    'popular_items' => '',
    'all_items' => '',
    'parent_item' => '',
    'parent_item_colon' => '',
    'edit_item' => '',
    'update_item' => '',
    'add_new_item' => '',
    'new_item_name' => '',
    'separate_items_with_commas' => '',
    'add_or_remove_items' => '',
    'choose_from_most_used' => '',
    ) );

  5. Michael Beckwith
    Plugin Author

    Posted 2 years ago #

    No, you shouldn't have to register it yourself as well, because that would ruin the whole point of the plugin :)

    Not sure what's going on with your case. I'm wondering if something else is going on with hooks/filters to interfere. I just set up the same taxonomy for a page and hierarchical being true, and it shows up with a get_taxonomy() function call.

    Is your site at a point where you could still disable all plugins and temporarily change themes? or are you pretty dependent on not changing those around much?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Type UI
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic