Register a block template.
Parameters
$template_name
stringrequired- Template name in the form of
plugin_uri//template_name
. $args
array|stringoptionaltitle
stringOptional. Title of the template as it will be shown in the Site Editor and other UI elements.description
stringOptional. Description of the template as it will be shown in the Site Editor.content
stringOptional. Default content of the template that will be used when the template is rendered or edited in the editor.post_types
string[]Optional. Array of post types to which the template should be available.plugin
stringOptional. Slug of the plugin that registers the template.
Default:
array()
Source
function register_block_template( $template_name, $args = array() ) {
return WP_Block_Templates_Registry::get_instance()->register( $template_name, $args );
}
Changelog
Version | Description |
---|---|
6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.