wppaste
WordPress

WP_Block

Since
5.5.0
Source
wp-includes/class-wp-block.php:15
Class representing a parsed instance of a block.

Compatibility

WordPress
since 5.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 7

Every hook that fires from inside WP_Block, in the order it appears in the class, grouped by the method that fires it.

Properties · 9

$parsed_blockarraypublic
Original parsed array representation of block.
$namestring|nullpublic
Name of block.
$block_typeWP_Block_Typepublic
Block type associated with the instance.
$contextarraypublic
Block context values.
$available_contextarrayprotected
All available context of the current hierarchy.
$registryWP_Block_Type_Registryprotected
Block type registry.
$inner_blocksWP_Block_Listpublic
List of inner blocks (of this same class)
$inner_htmlstringpublic
Resultant HTML from inside block comment delimiters after removing inner blocks.
$inner_contentarraypublic
List of string fragments and null markers where inner blocks were found

Methods · 8

Source code

#[AllowDynamicProperties]class WP_Block { 	/**	 * Original parsed array representation of block.	 *	 * @since 5.5.0	 * @var array	 */	public $parsed_block; 	/**	 * Name of block.	 *	 * @example "core/paragraph"	 *	 * @since 5.5.0	 * @var string|null	 */	public $name; 	/**	 * Block type associated with the instance.	 *	 * @since 5.5.0	 * @var WP_Block_Type	 */	public $block_type; 	/**	 * Block context values.	 *	 * @since 5.5.0	 * @var array	 */	public $context = array(); 	/**	 * All available context of the current hierarchy.	 *	 * @since 5.5.0	 * @var array	 */	protected $available_context = array(); 	/**	 * Block type registry.	 *	 * @since 5.9.0	 * @var WP_Block_Type_Registry	 */	protected $registry; 	/**	 * List of inner blocks (of this same class)	 *	 * @since 5.5.0	 * @var WP_Block_List	 */	public $inner_blocks = array(); 	/**	 * Resultant HTML from inside block comment delimiters after removing inner	 * blocks.	 *	 * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..."	 *	 * @since 5.5.0	 * @var string	 */	public $inner_html = ''; 	/**	 * List of string fragments and null markers where inner blocks were found	 *	 * @example array(	 *   'inner_html'    => 'BeforeInnerAfter',	 *   'inner_blocks'  => array( block, block ),	 *   'inner_content' => array( 'Before', null, 'Inner', null, 'After' ),	 * )

Changelog

Introduced in 5.5.0. 3 changes between 6.7.7 and 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.9.7
Method get_block_bindings_processor() added.verified against source
6.8.8
Method refresh_context_dependents() added.verified against source
6.8.8
Method refresh_parsed_block_dependents() added.verified against source
5.5.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/class-wp-block.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.