On this page
wp_category_checklist( int $post_id, int $descendants_and_self, int[]|false $selected_cats = false, int[]|false $popular_cats = false, Walker $walker = null, bool $checked_ontop = true )
Outputs an unordered list of checkbox input elements labeled with category names.
Description
See also
Parameters
$post_idint Optional-
Post to generate a categories checklist for. Default 0.
$selected_cats must not be an array. Default 0. $descendants_and_selfint Optional-
ID of the category to output along with its descendants.
Default 0. $selected_catsint[]|false Optional-
Array of category IDs to mark as checked.
Default:
false $popular_catsint[]|false Optional-
Array of category IDs to receive the "popular-category" class.
Default:
false $walkerWalker Optional-
Walker object to use to build the output.
Default is a Walker_Category_Checklist instance.Default:
null $checked_ontopbool Optional-
Whether to move checked items out of the hierarchy and to the top of the list.
Default:
true
Source
File: wp-admin/includes/template.php. View all references
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist(
$post_id,
array(
'taxonomy' => 'category',
'descendants_and_self' => $descendants_and_self,
'selected_cats' => $selected_cats,
'popular_cats' => $popular_cats,
'walker' => $walker,
'checked_ontop' => $checked_ontop,
)
);
}
Related
Uses
| Uses | Description |
|---|---|
| wp_terms_checklist() wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. |
Used By
| Used By | Description |
|---|---|
| dropdown_categories() wp-admin/includes/deprecated.php | Legacy function used to generate the categories checklist control. |
Changelog
| Version | Description |
|---|---|
| 2.5.1 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_category_checklist