HTTP/2 301
server: nginx
date: Fri, 26 Dec 2025 18:39:12 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/classes/wp_block_templates_registry/unregister/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
HTTP/2 200
server: nginx
date: Fri, 26 Dec 2025 18:39:13 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
WP_Block_Templates_Registry::unregister() – Method | Developer.WordPress.org
WordPress Developer Resources
WP_Block_Templates_Registry::unregister()
WP_Block_Templates_Registry::unregister( string $template_name ): WP_Block_Template|WP_Error
$template_namestringrequiredTemplate name including namespace.
public function unregister( $template_name ) {
if ( ! $this->is_registered( $template_name ) ) {
_doing_it_wrong(
__METHOD__,
/* translators: %s: Template name. */
sprintf( __( 'Template "%s" is not registered.' ), $template_name ),
'6.7.0'
);
/* translators: %s: Template name. */
return new WP_Error( 'template_not_registered', __( 'Template "%s" is not registered.' ) );
}
$unregistered_template = $this->registered_templates[ $template_name ];
unset( $this->registered_templates[ $template_name ] );
return $unregistered_template;
}
View all references View on Trac View on GitHub
| Version | Description |
|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.