Filter hook 'block_parser_class'

in WP Core File wp-includes/blocks.php at line 2392

View Source

block_parser_class

Filter Hook
Description
Filter to allow plugins to replace the server-side block parser.

Hook Information

File Location wp-includes/blocks.php View on GitHub
Hook Type Filter
Line Number 2392

Hook Parameters

Type Name Description
string $parser_class Name of block parser class.

Usage Examples

Basic Usage
<?php
// Hook into block_parser_class
add_filter('block_parser_class', 'my_custom_filter', 10, 1);

function my_custom_filter($parser_class) {
    // Your custom filtering logic here
    return $parser_class;
}

Source Code Context

wp-includes/blocks.php:2392 - How this hook is used in WordPress core
<?php
2387  	 *
2388  	 * @since 5.0.0
2389  	 *
2390  	 * @param string $parser_class Name of block parser class.
2391  	 */
2392  	$parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' );
2393  
2394  	$parser = new $parser_class();
2395  	return $parser->parse( $content );
2396  }
2397  

PHP Documentation

<?php
/**
	 * Filter to allow plugins to replace the server-side block parser.
	 *
	 * @since 5.0.0
	 *
	 * @param string $parser_class Name of block parser class.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/blocks.php
Related Hooks

Related hooks will be displayed here in future updates.