diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/blocks/categories.php --- a/wp/wp-includes/blocks/categories.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/blocks/categories.php Fri Sep 05 18:40:08 2025 +0200 @@ -8,13 +8,15 @@ /** * Renders the `core/categories` block on server. * + * @since 5.0.0 + * * @param array $attributes The block attributes. * * @return string Returns the categories list/dropdown markup. */ function render_block_core_categories( $attributes ) { static $block_id = 0; - $block_id++; + ++$block_id; $args = array( 'echo' => false, @@ -22,6 +24,7 @@ 'orderby' => 'name', 'show_count' => ! empty( $attributes['showPostCounts'] ), 'title_li' => '', + 'hide_empty' => empty( $attributes['showEmpty'] ), ); if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) { $args['parent'] = 0; @@ -62,6 +65,8 @@ /** * Generates the inline script for a categories dropdown field. * + * @since 5.0.0 + * * @param string $dropdown_id ID of the dropdown field. * * @return string Returns the dropdown onChange redirection script. @@ -69,25 +74,25 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) { ob_start(); ?> - ', '' ), '', ob_get_clean() ) ); } /** * Registers the `core/categories` block on server. + * + * @since 5.0.0 */ function register_block_core_categories() { register_block_type_from_metadata(