wp_category_checklist()
Outputs an unordered list of checkbox input elements labeled with category names.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wp_category_checklist( $post_id, $descendants_and_self, $selected_cats, $popular_cats, $walker, $checked_ontop );
- $post_id(int)
- Post to generate a categories checklist for.
$selected_catsmust not be an array. - $descendants_and_self(int)
- ID of the category to output along with its descendants.
- $selected_cats(int[]|false)
- Array of category IDs to mark as checked.
По умолчанию:false - $popular_cats(int[]|false)
- Array of category IDs to receive the "popular-category" class.
По умолчанию:false - $walker(Walker)
- Walker object to use to build the output.
По умолчанию:Walker_Category_Checklist instance - $checked_ontop(true|false)
- Whether to move checked items out of the hierarchy and to the top of the list.
По умолчанию:true
Заметки
- Смотрите: wp_terms_checklist()
Список изменений
| С версии 2.5.1 | Введена. |
Код wp_category_checklist() wp category checklist WP 6.9.4
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,
)
);
}