plugin updates
This commit is contained in:
@@ -358,3 +358,38 @@ function _resolve_template_for_new_post( $wp_query ) {
|
||||
$wp_query->set( 'post_status', 'auto-draft' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block template.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
|
||||
* @param array|string $args {
|
||||
* @type string $title Optional. Title of the template as it will be shown in the Site Editor
|
||||
* and other UI elements.
|
||||
* @type string $description Optional. Description of the template as it will be shown in the Site
|
||||
* Editor.
|
||||
* @type string $content Optional. Default content of the template that will be used when the
|
||||
* template is rendered or edited in the editor.
|
||||
* @type string[] $post_types Optional. Array of post types to which the template should be available.
|
||||
* @type string $plugin Optional. Slug of the plugin that registers the template.
|
||||
* }
|
||||
* @return WP_Block_Template|WP_Error The registered template object on success, WP_Error object on failure.
|
||||
*/
|
||||
function register_block_template( $template_name, $args = array() ) {
|
||||
return WP_Block_Templates_Registry::get_instance()->register( $template_name, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a block template.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
|
||||
* @return WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if the
|
||||
* template doesn't exist.
|
||||
*/
|
||||
function unregister_block_template( $template_name ) {
|
||||
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user