Only display top level taxonomy on the edit post page with option to expand sub-categories

This is a VERY untested approach, but the recent addition of CSS’s :has selector has been top-of-mind for me lately, and I wondered if a simple solution could be built using purely CSS..

As a proof of concept, add the following to your site’s admin CSS:

#categorychecklist > li .children{display:none;}
#categorychecklist > li:has(input:checked ) .children{display:block;} 

For context, this hides all children categories in the list unless either the parent or the child has been checked. Thus, by default, you’ll ONLY see the top-level categories when creating a new post. If you want to assign children categories, then you check the parent and it expands.

This doesn’t let you “browse” the children categories without clicking the parent, so it’s not foolproof. You’d have to click the parent, check the child, and then deselect the parent if you didn’t want it. But at least it cleans up the visuals quite a bit!

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)