Custom taxonomy only shows 0 in autocomplete for terms and “Choose from the most used tags”

I have a custom post type (rezept that I added a custom taxonomy Allergiefrei to. I got this working so far. Adding terms to the custom taxonomy’s box works, too, but autocomplete and ‘Choose from the most used tags’ only shows “0”.

Here’s the code where I register the custom taxonomy:

function register_rezept_taxonomies() {
  register_taxonomy(
    'Allergiefrei',
    'rezept',
    array(
      'label' => 'Allergien',
      'rewrite' => array('slug' => 'allergien')
    )
  );
}

add_action('init', 'register_rezept_taxonomies');

I’m defining custom taxonomies and the post type in a plugin.

1 Answer
1

Turns out you can’t use uppercase taxonomy ids. Those work, mostly, but when WordPress sanitizes Ajax calls, everything uppercase is converted to lower case and it won’t find the correct taxonomy.

The solution is to only define and use lowercase taxonomy ids.

Leave a Comment