Skip to content

WordPress, Custom Taxonomy, and “An unidentified error has occurred”

An unidentified error has occurred trying to list tags

Working on a plugin today, part of which includes a custom taxonomy, and came across a snag today.

Got the taxonomy added, along with the custom post type it was associated with. The meta box showed up just like it should. And I could type in items for the custom taxonomy and have them stick.

The snag was when I tried to type one in. The dropdown for auto complete would only show a 0. And clicking on the most used tags link would show “An unidentified error has occurred.”

Since this was the first time I’ve done anything with custom taxonomies, I was trying to make the fix way harder than it was.

The solution wound up being very easy. I just changed the priority on the add_action call that added my callback to admin_init to a lower number and it fixed it.

Published inWordPress

13 Comments

  1. Just to be complete on the steps you describe above. The taxonomy is created in functions.php.

    I tried your solution, by increasing the priority:


    which in my case produced the following code:

    add_action( 'init', 'create_ProductBrand',100 );

    but this didn’t work. Did I miss something here? What were the other solutions you tried?

    • Don’t remember what else I tried, although it involved watching a lot of network traffic with firebug.

      Not sure what part of this matters, but I’ve got my action callback tied to both the init and admin_init actions, both with a priority of 10. Something in that mix makes it work. Maybe init isn’t called by the ajax script? Not sure about that, but it’d be a place to start.

  2. This turned out to be case-sensitivity for me:

    register_taxonomy("Location"...
    …was causing common/autocomplete to break,

    register_taxonomy("location"...
    …works like a charm =)

    • You can leave out the last closing PHP tag entirely. It doesn’t have to be there. And that’ll keep you from having to worry about white space after it.

  3. trish trish

    This problem continues to persist. In my case, the error was occurring because of an extra line (i.e. white space) BEFORE the opening tag in the functions file. Removing the extra line/space fixed the error.

Leave a Reply

Your email address will not be published. Required fields are marked *