diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-walker-category-checklist.php --- a/wp/wp-admin/includes/class-walker-category-checklist.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/class-walker-category-checklist.php Tue Dec 15 13:49:49 2020 +0100 @@ -21,7 +21,7 @@ public $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', - ); //TODO: decouple this + ); // TODO: Decouple this. /** * Starts the list before the elements are added. @@ -75,37 +75,41 @@ $taxonomy = $args['taxonomy']; } - if ( $taxonomy == 'category' ) { + if ( 'category' === $taxonomy ) { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; } - $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; - $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; + $args['popular_cats'] = ! empty( $args['popular_cats'] ) ? array_map( 'intval', $args['popular_cats'] ) : array(); - $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; + $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'] ) ) { + if ( in_array( $category->term_id, $args['selected_cats'], true ) ) { $inner_class .= ' selected'; $aria_checked = 'true'; } - /** This filter is documented in wp-includes/category-template.php */ $output .= "\n" . '