Function: wp_category_checklist

wp_category_checklist( integer $post_id, integer $descendants_and_self, array<mixed,integer> $selected_cats, array<mixed,integer> $popular_cats, object $walker, boolean $checked_ontop )

Output an unordered list of checkbox input elements labeled with category names.

Shortcut: wcc

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.


Name Type(s) Default Value Description
$post_id integer

Optional. Post to generate a categories checklist for. Default 0. $selected_cats must not be an array. Default 0.

$descendants_and_self integer

Optional. ID of the category to output along with its descendants. Default 0.

$selected_cats array<mixed,integer> false

Optional. Array of category IDs to mark as checked. Default false.

$popular_cats array<mixed,integer> false

Optional. Array of category IDs to receive the "popular-category" class. Default false.

$walker object null

Optional. Walker object to use to build the output. Default is a Walker_Category_Checklist instance.

$checked_ontop boolean true

Optional. Whether to move checked items out of the hierarchy and to the top of the list. Default true.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.