render_block_core_home_link()WP 1.0

Renders the core/home-link block.

Хуков нет.

Возвращает

Строку. Returns the post content with the home url added.

Использование

render_block_core_home_link( $attributes, $content, $block );
$attributes(массив) (обязательный)
The block attributes.
$content(строка) (обязательный)
The saved content.
$block(WP_Block) (обязательный)
The parsed block.

Код render_block_core_home_link() WP 6.0.2

function render_block_core_home_link( $attributes, $content, $block ) {
	if ( empty( $attributes['label'] ) ) {
		return '';
	}

	$wrapper_attributes = block_core_home_link_build_li_wrapper_attributes( $block->context );

	$aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';

	$html = '<li ' . $wrapper_attributes . '><a class="wp-block-home-link__content wp-block-navigation-item__content" rel="home"' . $aria_current;

	// Start appending HTML attributes to anchor tag.
	$html .= ' href="' . esc_url( home_url() ) . '"';

	// End appending HTML attributes to anchor tag.
	$html .= '>';

	if ( isset( $attributes['label'] ) ) {
		$html .= wp_kses_post( $attributes['label'] );
	}

	$html .= '</a></li>';
	return $html;
}