Is there a way to avoid WordPress "flattening" the category tree when a child category is selected?
This applies to both custom taxonomies and WP's built in "category" taxonomy.
To explain further, say I have the following category tree:
Parent
Child
Grandchild
Another parent
Another child
Another child
A third parent
If I then select "Grandchild" as my category, the tree will now look like this upon saving:
Grandchild
Parent
Child
Another parent
Another child
Another child
A third parent
This makes it very hard for authors to remember which grandchild belongs to which parent and imo makes absolutely zero sense. I guess one reason for this might be so that the selected category is always in the top of the list, but I would very much like to disable this behaviour.
Also see attached image.
Please note that this is not theme or plugin-related. I tried this with a completely fresh WP-install with zero plugins and the default theme.
Is there a way to avoid WordPress "flattening" the category tree when a child category is selected?
This applies to both custom taxonomies and WP's built in "category" taxonomy.
To explain further, say I have the following category tree:
Parent
Child
Grandchild
Another parent
Another child
Another child
A third parent
If I then select "Grandchild" as my category, the tree will now look like this upon saving:
Grandchild
Parent
Child
Another parent
Another child
Another child
A third parent
This makes it very hard for authors to remember which grandchild belongs to which parent and imo makes absolutely zero sense. I guess one reason for this might be so that the selected category is always in the top of the list, but I would very much like to disable this behaviour.
Also see attached image.
Please note that this is not theme or plugin-related. I tried this with a completely fresh WP-install with zero plugins and the default theme.
Share Improve this question asked Jan 3, 2017 at 14:05 powerbuoypowerbuoy 8421 gold badge7 silver badges15 bronze badges2 Answers
Reset to default 2I haven't fully tested this, but it may be helpful: Categories in Hierarchical Order plugin at https://wordpress/plugins/categories-in-hierarchical-order/
The plugin can be resumed to this simple code:
add_filter( 'wp_terms_checklist_args', function( $args ) {
$args['checked_ontop'] = false;
return $args;
});