Register a block template.
Parameters
$template_namestringrequired- Template name in the form of
plugin_uri//template_name. $argsarray|stringoptionaltitlestringOptional. Title of the template as it will be shown in the Site Editor and other UI elements.descriptionstringOptional. Description of the template as it will be shown in the Site Editor.contentstringOptional. Default content of the template that will be used when the template is rendered or edited in the editor.post_typesstring[]Optional. Array of post types to which the template should be available.pluginstringOptional. 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.