wip
This commit is contained in:
@@ -60,11 +60,8 @@ final class WP_Block_Templates_Registry {
|
||||
}
|
||||
|
||||
if ( $error_message ) {
|
||||
_doing_it_wrong(
|
||||
__METHOD__,
|
||||
$error_message,
|
||||
'6.7.0'
|
||||
);
|
||||
_doing_it_wrong( __METHOD__, $error_message, '6.7.0' );
|
||||
|
||||
return new WP_Error( $error_code, $error_message );
|
||||
}
|
||||
|
||||
@@ -204,11 +201,11 @@ final class WP_Block_Templates_Registry {
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param string $template_name Template name.
|
||||
* @param string|null $template_name Template name.
|
||||
* @return bool True if the template is registered, false otherwise.
|
||||
*/
|
||||
public function is_registered( $template_name ) {
|
||||
return isset( $this->registered_templates[ $template_name ] );
|
||||
return isset( $template_name, $this->registered_templates[ $template_name ] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,14 +218,12 @@ final class WP_Block_Templates_Registry {
|
||||
*/
|
||||
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.' ) );
|
||||
$error_message = sprintf( __( 'Template "%s" is not registered.' ), $template_name );
|
||||
|
||||
_doing_it_wrong( __METHOD__, $error_message, '6.7.0' );
|
||||
|
||||
return new WP_Error( 'template_not_registered', $error_message );
|
||||
}
|
||||
|
||||
$unregistered_template = $this->registered_templates[ $template_name ];
|
||||
|
||||
Reference in New Issue
Block a user