Make WordPress Core

Changeset 59201


Ignore:
Timestamp:
10/09/2024 10:09:30 PM (3 months ago)
Author:
peterwilsoncc
Message:

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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template.php

    r59073 r59201  
    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() ) {
     380function register_block_template( $template_name, $args = array() ) {
    381381    return WP_Block_Templates_Registry::get_instance()->register( $template_name, $args );
    382382}
     
    391391 *                                    template doesn't exist.
    392392 */
    393 function wp_unregister_block_template( $template_name ) {
     393function unregister_block_template( $template_name ) {
    394394    return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
    395395}
  • trunk/tests/phpunit/tests/block-template.php

    r59073 r59201  
    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();
     
    450450        $this->assertArrayHasKey( $template_name, $templates );
    451451
    452         wp_unregister_block_template( $template_name );
     452        unregister_block_template( $template_name );
    453453    }
    454454
     
    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' );
     
    472472        $this->assertSame( 'Test Template', $template->title );
    473473
    474         wp_unregister_block_template( $template_name );
     474        unregister_block_template( $template_name );
    475475    }
    476476
  • trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php

    r59073 r59201  
    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' );
     
    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' );
Note: See TracChangeset for help on using the changeset viewer.