By default WordPress show flat list of categories if user selected some of them.
The code fixes it and shows tree-like list of categories in the admin section.
1 2 3 4 5 6 7 8 9 10 11 12 13 | function category_tree_view( $args , $post_id ) { if ( get_post_type( $post_id ) == 'post' && $args [ 'taxonomy' ] == 'category' ) { $args [ 'checked_ontop' ] = false; } return $args ; } add_filter( 'wp_terms_checklist_args' , 'category_tree_view' , 1, 2 ); |
Or you may install Taxonomy Checklist Tree plugin.