WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a hierarchical custom taxonomy that I add terms to programatically using the following code in a loop:

-- SNIP --
    $args = array(
        'description'=> '',
        'slug' => str_replace(' ','-',preg_replace('/[^\00-\255]+/u', '', $term)),
        'parent' => $parent

    $term_id = wp_insert_term(
-- SNIP --

Which works ok in terms of adding the widget terms in the desired hierarchical structure, however, on the taxonomy management page in admin, there is some really strange behavior. Only the top-level terms are shown in the list (2) even though it says 28 items found and there are pagination links for page 2 which displays nothing.

If I delete the top level terms, the second level is shown in the listing, etc.

Any ideas as to why this is happening and how to resolve would be appreciated.

share|improve this question
up vote 2 down vote accepted

I encountered a very similar situation, and I believe it may very well be the same situation you are experiencing. Please read the WPSE question Programmatically insert hierarchical terms & set terms for post causes glitch? and follow up with the answer provided by @Manny Fleurmond.

share|improve this answer
That was it, thanks. – code_burgar Feb 20 '13 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.