diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/blocks/categories.php --- a/wp/wp-includes/blocks/categories.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/blocks/categories.php Wed Sep 21 18:19:35 2022 +0200 @@ -28,32 +28,30 @@ $id = 'wp-block-categories-' . $block_id; $args['id'] = $id; $args['show_option_none'] = __( 'Select Category' ); - $wrapper_markup = '
%2$s
'; + $wrapper_markup = '
%2$s
'; $items_markup = wp_dropdown_categories( $args ); $type = 'dropdown'; if ( ! is_admin() ) { - $wrapper_markup .= build_dropdown_script_block_core_categories( $id ); + // Inject the dropdown script immediately after the select dropdown. + $items_markup = preg_replace( + '#(?<=)#', + build_dropdown_script_block_core_categories( $id ), + $items_markup, + 1 + ); } } else { - $wrapper_markup = ''; + $wrapper_markup = ''; $items_markup = wp_list_categories( $args ); $type = 'list'; } - $class = "wp-block-categories wp-block-categories-{$type}"; - - if ( isset( $attributes['align'] ) ) { - $class .= " align{$attributes['align']}"; - } - - if ( isset( $attributes['className'] ) ) { - $class .= " {$attributes['className']}"; - } + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => "wp-block-categories-{$type}" ) ); return sprintf( $wrapper_markup, - esc_attr( $class ), + $wrapper_attributes, $items_markup ); }