Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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(
      $term, 
      'widgets', 
      $args
    );
-- 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
add comment

1 Answer

up vote 2 down vote accepted
+50

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
1  
That was it, thanks. –  code_burgar Feb 20 '13 at 16:53
add comment

Your Answer

 
discard

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.