`. Support these by defaulting an undefined label and // buttonText to `__( 'Search' )`. $attributes = wp_parse_args( $attributes, array( 'label' => __( 'Search' ), 'buttonText' => __( 'Search' ), ) ); $input_id = 'wp-block-search__input-' . ++$instance_id; $label_markup = ''; $button_markup = ''; if ( ! empty( $attributes['label'] ) ) { $label_markup = sprintf( '', $input_id, $attributes['label'] ); } else { $label_markup = sprintf( '', $input_id, __( 'Search' ) ); } $input_markup = sprintf( '', $input_id, esc_attr( get_search_query() ), esc_attr( $attributes['placeholder'] ) ); if ( ! empty( $attributes['buttonText'] ) ) { $button_markup = sprintf( '', $attributes['buttonText'] ); } $class = 'wp-block-search'; if ( isset( $attributes['className'] ) ) { $class .= ' ' . $attributes['className']; } if ( isset( $attributes['align'] ) ) { $class .= ' align' . $attributes['align']; } return sprintf( '
', esc_attr( $class ), esc_url( home_url( '/' ) ), $label_markup . $input_markup . $button_markup ); } /** * Registers the `core/search` block on the server. */ function register_block_core_search() { register_block_type_from_metadata( __DIR__ . '/search', array( 'render_callback' => 'render_block_core_search', ) ); } add_action( 'init', 'register_block_core_search' );