Hi all,
I’ve been experiencing similar issue on pretty much all sites which I upgraded to WP 6.7 and which are using Classic editor. The core of the problem is coming from slightly adjusted markup used for rendering category list in admin screen widget.
As a quick fix, adding this piece of code into the functions.php of your active theme should solve the problem. Give that a try and let me know.
add_filter('wp_terms_checklist_args', 'wpa_custom_walker_category_checklist');
function wpa_custom_walker_category_checklist($args)
{
$args['walker'] = new Wpa_Custom_Walker_Category_Checklist();
return $args;
}
if ( !class_exists('Walker_Category_Checklist') )
require_once ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php';
/**
*
*/
class Wpa_Custom_Walker_Category_Checklist extends Walker_Category_Checklist
{
/**
* [start_el description]
* @param [type] &$output [description]
* @param [type] $data_object [description]
* @param integer $depth [description]
* @param array $args [description]
* @param integer $current_object_id [description]
* @return [type] [description]
*/
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
// Restores the more descriptive, specific name for use within this method.
$category = $data_object;
if ( empty( $args['taxonomy'] ) ) {
$taxonomy = 'category';
} else {
$taxonomy = $args['taxonomy'];
}
if ( 'category' === $taxonomy ) {
$name = 'post_category';
} else {
$name = 'tax_input[' . $taxonomy . ']';
}
$args['popular_cats'] = ! empty( $args['popular_cats'] ) ? array_map( 'intval', $args['popular_cats'] ) : array();
$class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : '';
$args['selected_cats'] = ! empty( $args['selected_cats'] ) ? array_map( 'intval', $args['selected_cats'] ) : array();
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>';
} else {
$is_selected = in_array( $category->term_id, $args['selected_cats'], true );
$is_disabled = ! empty( $args['disabled'] );
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
checked( $is_selected, true, false ) .
disabled( $is_disabled, true, false ) . ' /> ' .
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
}
}
}