Posted by & filed under WordPress.

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.

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

  1. W00t

    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?

    • Ryan

      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.

      • W00t

        10 should be the default priority, so in order to lower mine, I’ve set it to 100. No luck though.

  2. Dan Sheerman

    This turned out to be case-sensitivity for me:

    …was causing common/autocomplete to break,

    …works like a charm =)

  3. developersq

    In my case, it was a space after closing ?> PHP tag. Try to go through all of your included theme files and remove any extra space after closing tag.

    • Ryan

      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.

  4. 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 *