parse_blocks

The timeline below displays how wordpress function parse_blocks has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Parses blocks out of a content string.
 *
 * @since 5.0.0
 *
 * @param string $content Post content.
 * @return array[] Array of parsed block objects.
 */
function 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);
}

WordPress Version: 5.4

/**
 * Parses blocks out of a content string.
 *
 * @since 5.0.0
 *
 * @param string $content Post content.
 * @return array[] Array of parsed block objects.
 */
function 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);
}

WordPress Version: 5.0

/**
 * Parses blocks out of a content string.
 *
 * @since 5.0.0
 *
 * @param string $content Post content.
 * @return array Array of parsed block objects.
 */
function 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);
}