How to select children categories when parent is selected?

You may for any reason need to make the parent category checkbox automatically check all child categories beneath it.. This is not the default behaviour of wordpress, thanks to this small tweak, you can still do it!

Add the following to your theme’s/plugin’s functions.php file:

add_action( 'admin_footer-post.php',     'ba_choose_children_with_parents' );
add_action( 'admin_footer-post-new.php', 'ba_choose_children_with_parents' );

* Choose children when parent is selected
function ba_choose_children_with_parents() { ?>



You can change the ID "categorychecklist" in the jQuery portion of this code to make it work with custom taxonomies as well and make it: #{taxonomy_name}checklist


Enjoy! smile