WordPress Child Terms Are Not Displayed Under Parent Terms In Admin For Custom Taxonomy

We recently encountered this scenario after manually importing a custom taxonomy with hierarchy into WordPress using phpMyAdmin.  When attempting to administer the custom taxonomy from the Admin menu, only the top level parent terms were displayed.  All the child terms were missing.  The number (count) of total terms displayed was correct but none of the child terms were visible.  So we knew the child terms were there, but WordPress wasn’t attributing them to their parent categories.

Inspecting the WordPress database tables showed that child terms were also defined in the wp_options table as serialized data under the field MY_CUSTOM_TAX_children.  The value for this setting for our custom taxonomy was empty.

a:0:{}

We were able to resolve this by deleting the option MY_CUSTOM_TAX_children for our custom taxonomy, which forced WordPress to regenerate the option and the value was now populated with the hierarchical data.

a:3:{i:63;a:9:{i:0;i:64;i:1;i:65;i:2;i:66;i:3;i:67;i:4;i:68;i:5;i:69;i:6;i:70;i:7;i:71;i:8;i:72;}i:73;a:8:{i:0;i:74;i:1;i:75;i:2;i:76;i:3;i:77;i:4;i:78;i:5;i:79;i:6;i:80;i:7;i:81;}i:88;a:7:{i:0;i:89;i:1;i:90;i:2;i:91;i:3;i:92;i:4;i:93;i:5;i:94;i:6;i:95;}}

The child terms were now correctly displayed under their corresponding parent terms in the Admin section.

To resolve this issue, you can manually delete the option from the database table wp_options or you can temporarily add the following into your functions.php file.  Remove the line once your option has been regenerated.

delete_option('MY_CUSTOM_TAX_children');

 

Available for Amazon Prime