Skip to content

Commit 4ccb5b4

Browse files
committed
Editor: Remove prefix from wp_(un)register_block_template() functions.
Removes the `wp_` prefix from block template registration functions for consistency with other block related registration functions. * `wp_register_block_template()` becomes `register_block_template()`. * `wp_unregister_block_template()` becomes `unregister_block_template()`. Props aljullu, aristath, youknowriad, swissspidy. Fixes #62193. git-svn-id: https://develop.svn.wordpress.org/trunk@59201 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ccb77c5 commit 4ccb5b4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/wp-includes/block-template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function _resolve_template_for_new_post( $wp_query ) {
377377
* }
378378
* @return WP_Block_Template|WP_Error The registered template object on success, WP_Error object on failure.
379379
*/
380-
function wp_register_block_template( $template_name, $args = array() ) {
380+
function register_block_template( $template_name, $args = array() ) {
381381
return WP_Block_Templates_Registry::get_instance()->register( $template_name, $args );
382382
}
383383

@@ -390,6 +390,6 @@ function wp_register_block_template( $template_name, $args = array() ) {
390390
* @return WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if the
391391
* template doesn't exist.
392392
*/
393-
function wp_unregister_block_template( $template_name ) {
393+
function unregister_block_template( $template_name ) {
394394
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
395395
}

tests/phpunit/tests/block-template.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,13 @@ public function test_get_block_templates_paths_dir_doesnt_exists() {
443443
public function test_get_block_templates_from_registry() {
444444
$template_name = 'test-plugin//test-template';
445445

446-
wp_register_block_template( $template_name );
446+
register_block_template( $template_name );
447447

448448
$templates = get_block_templates();
449449

450450
$this->assertArrayHasKey( $template_name, $templates );
451451

452-
wp_unregister_block_template( $template_name );
452+
unregister_block_template( $template_name );
453453
}
454454

455455
/**
@@ -465,13 +465,13 @@ public function test_get_block_template_from_registry() {
465465
'title' => 'Test Template',
466466
);
467467

468-
wp_register_block_template( $template_name, $args );
468+
register_block_template( $template_name, $args );
469469

470470
$template = get_block_template( 'block-theme//test-template' );
471471

472472
$this->assertSame( 'Test Template', $template->title );
473473

474-
wp_unregister_block_template( $template_name );
474+
unregister_block_template( $template_name );
475475
}
476476

477477
/**

tests/phpunit/tests/rest-api/wpRestTemplatesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function test_get_item_from_registry() {
546546
'post_types' => array( 'post', 'page' ),
547547
);
548548

549-
wp_register_block_template( $template_name, $args );
549+
register_block_template( $template_name, $args );
550550

551551
$request = new WP_REST_Request( 'GET', '/wp/v2/templates/test-plugin//test-template' );
552552
$response = rest_get_server()->dispatch( $request );
@@ -566,7 +566,7 @@ public function test_get_item_from_registry() {
566566
$this->assertSame( 'Test Template', $data['title']['rendered'], 'Template title mismatch.' );
567567
$this->assertSame( 'test-plugin', $data['plugin'], 'Plugin name mismatch.' );
568568

569-
wp_unregister_block_template( $template_name );
569+
unregister_block_template( $template_name );
570570

571571
$request = new WP_REST_Request( 'GET', '/wp/v2/templates/test-plugin//test-template' );
572572
$response = rest_get_server()->dispatch( $request );

0 commit comments

Comments
 (0)