Viewing 1 replies (of 1 total)
  • I’m facing the same problem right now. WP-User frontend relies on wordpress function wp_terms_checklist() to output an unordered checkbox list of categories. But it doesn’t accept any argument to exclude a particular category ID.

    The workaround that worked for me was to use the argument $descendants_and_self to show only a category and its children, which was exactly what I needed.

    Here is the modified function in file wpuf_functions.php, adding the argument $childof, in my case category ID 16


    function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $tax = 'category', $childof = '16' ) {
    require_once ABSPATH . '/wp-admin/includes/template.php';

    $walker = new WPUF_Walker_Category_Checklist();

    echo '<ul class="wpuf-category-checklist">';
    wp_terms_checklist( $post_id, array(
    'taxonomy' => $tax,
    'descendants_and_self' => $childof,
    'selected_cats' => $selected_cats,
    'popular_cats' => false,
    'walker' => $walker,
    'checked_ontop' => false
    ) );
    echo '';
    }

    Hope it helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude categories’ is closed to new replies.