WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Admin New Post Categories only child categories (3 posts)

  1. padreed123
    Member
    Posted 1 year ago #

    Im trying to change my new post categories check boxes to only show the deepest level of children(no parent cats). I see this function on line 339 of /wp-admin/includes/meta-boxes.php

    <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>

    but there's no depth $arg or anything like it according to the codex.

    Anyone have any ideas? Thx!

  2. bcworkz
    Member
    Posted 1 year ago #

    I'm unaware of any terms or category function that would easily return only the deepest children. The only way I know of to get such results is to extend the Walker class to go through the entire structure and collect all terms that have no children. You can then create a new object based on this and pass it to wp_terms_checklist() or wp_category_checklist() to have it output the categories you want.

  3. padreed123
    Member
    Posted 1 year ago #

    Thats what I was worried about.. So much for being a lazy programmer. :'(

Topic Closed

This topic has been closed to new replies.

About this Topic