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.


Top ↑

Return

(bool) True if the pattern was registered with success and false otherwise.


Top ↑

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.