Child Terms not Displaying on the Taxonomy Term Admin Screen

I am experiencing an issue where terms with a parent are not being displayed in the category admin screen. The screen gives the total number of terms that should be there (i.e., 32), but only displays parent terms (i.e., 9).

Interestingly, if run:

Read More
var_dump( get_terms( 'category' ) );

all 32 terms are returned.

Does anyone have an idea as to how I might be able to get those terms to display?

Thanks!

Related posts

Leave a Reply

3 comments

  1. I’ve encountered this kind of problem when i was building some front end post / term creation form. The number oh the ‘Right Now’ dashboard shows the right number of term, but the new term doesn’t shows up in the taxonomy admin screen.

    The solution:

    delete_option('taxonomy-name_children');
    

    where ‘taxonomy-name’ is the name of the taxonomy.

    Hope this help.

  2. The issue was that somehow the “category_children” value in “wp_options” was reset to a blank, serialized array. In certain contexts, WordPress uses this value to determine the parent child relationship. The value in my DB suggested no such relationships exist. The fix for the issue was to add/edit/delete a category as it updates this value.

  3. I don’t have a ’15 reputation’ … however, thank you ifdion

    For those sitting behind phpMyAdmin or a MySQL client, you can also do:


    DELETE FROM wp_options WHERE option_name LIKE 'TAXNAME_children';

    I came across this doing a 14K “product” import with code similar to (inside a huge loop):

    if (!term_exists($row->vendor,'manufacturer')){
        $v = wp_insert_term($row->vendor,'manufacturer');
        $lv = $v['term_id'];
    }
    
    if (!term_exists($row->series,'manufacturer',$lv)){
        $s = wp_insert_term($row->series,'manufacturer',array('parent' => $lv));
        $ls = $s['term_id'];
    }
    

    And for some reason, all the posts inserted worked, but just wern’t displaying the child taxonomies on the admin page. Thanks again for this tip.