Uses
Uses | Description |
---|---|
wp-includes/l10n.php: __() | Retrieve the translation of $text. |
wp-includes/functions.php: _doing_it_wrong() | Mark something as being incorrectly called. |
Registers a pattern.
(string) (Required) Pattern name including namespace.
(array) (Required) Array containing the properties of the pattern: title, content, description, viewportWidth, categories, keywords.
(bool) True if the pattern was registered with success and false otherwise.
File: wp-includes/class-wp-block-patterns-registry.php
public function register( $pattern_name, $pattern_properties ) { if ( ! isset( $pattern_name ) || ! is_string( $pattern_name ) ) { _doing_it_wrong( __METHOD__, __( 'Pattern name must be a string.' ), '5.5.0' ); return false; } if ( ! isset( $pattern_properties['title'] ) || ! is_string( $pattern_properties['title'] ) ) { _doing_it_wrong( __METHOD__, __( 'Pattern title must be a string.' ), '5.5.0' ); return false; } if ( ! isset( $pattern_properties['content'] ) || ! is_string( $pattern_properties['content'] ) ) { _doing_it_wrong( __METHOD__, __( 'Pattern content must be a string.' ), '5.5.0' ); return false; } $this->registered_patterns[ $pattern_name ] = array_merge( $pattern_properties, array( 'name' => $pattern_name ) ); return true; }
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_patterns_registry/register