Parses blocks out of a content string.
$contentstringrequired
...$0 arrayblockName stringattrs arrayinnerBlocks array[]innerHTML stringinnerContent arrayfunction parse_blocks( $content ) {
/**
* Filter to allow plugins to replace the server-side block parser.
*
* @since 5.0.0
*
* @param string $parser_class Name of block parser class.
*/
$parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' );
$parser = new $parser_class();
return $parser->parse( $content );
}
Filter to allow plugins to replace the server-side block parser.
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/parse_blocks