wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



do_blocks › WordPress Function

Od5.0.0
Przestarzałyn/a
do_blocks ( $content )
Parametry:
  • (string) $content Post content.
    Wymagane: Tak
Powrót:
  • (string) Updated post content.
Zdefiniowane na:
Codex:

Parses dynamic blocks out of `post_content` and re-renders them.



Źródło

function do_blocks( $content ) {
	$blocks = parse_blocks( $content );
	$output = '';

	foreach ( $blocks as $block ) {
		$output .= render_block( $block );
	}

	// If there are blocks in this content, we shouldn't run wpautop() on it later.
	$priority = has_filter( 'the_content', 'wpautop' );
	if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
		remove_filter( 'the_content', 'wpautop', $priority );
		add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
	}

	return $output;
}