admin管理员组文章数量:1296854
On the post edit screen there is the meta box for categories that utilizes the Walker_Category_Checklist
class to create the category checklist within the meta box. One of the conditions (line 90 of /wp-admin/includes/class-walker-category-checklist.php
in WP 5.7.1) is:
if ( ! empty( $args['list_only'] ) ) {
// do some things
}
What is list_only
? It does not appear on the dev reference for Walker_Category_Checklist::start_el
nor wp_terms_checklist()
.
And it appears only twice in WP core:
includes/template.php
- line 120:
$args['list_only'] = ! empty( $parsed_args['list_only'] );
- line 120:
wp-admin/includes/class-walker-category-checklist.php
- line 90 -
if ( ! empty( $args['list_only'] ) ) {
as shown fully above.
- line 90 -
Here is the whole if clause starting at 90:
if ( ! empty( $args['list_only'] ) ) {
$aria_checked = 'false';
$inner_class = 'category';
if ( in_array( $category->term_id, $args['selected_cats'], true ) ) {
$inner_class .= ' selected';
$aria_checked = 'true';
}
$output .= "\n" . '<li' . $class . '>' .
'<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
本文标签: categoriesWhy does the argument listonly do on WalkerCategoryCheckliststartel
版权声明:本文标题:categories - Why does the argument list_only do on Walker_Category_Checklist::start_el? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741586383a2386870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论