register_block_pattern() WordPress Function
The register_block_pattern() function is used to register a custom block pattern for use in the editor. Block patterns are a way to group blocks together to create a specific layout or design. This function should be called from the 'init' action hook.
register_block_pattern( string $pattern_name, array $pattern_properties ) #
Registers a new block pattern.
Parameters
- $pattern_name
(string)(Required)Block pattern name including namespace.
- $pattern_properties
(array)(Required)List of properties for the block pattern. See WP_Block_Patterns_Registry::register() for accepted arguments.
Return
(bool) True if the pattern was registered with success and false otherwise.
Source
File: wp-includes/class-wp-block-patterns-registry.php
function register_block_pattern( $pattern_name, $pattern_properties ) {
return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties );
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |