Skip to content

Commit df6030f

Browse files
ellatrixpriethoriqbal-web
authored andcommitted
Template activation: rename new endpoints (#72700)
Co-authored-by: ellatrix <[email protected]> Co-authored-by: priethor <[email protected]> Co-authored-by: iqbal-web <[email protected]>
1 parent ddc8431 commit df6030f

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

backport-changelog/6.9/8063.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ https://github.com/WordPress/wordpress-develop/pull/8063
1111
* https://github.com/WordPress/gutenberg/pull/72141
1212
* https://github.com/WordPress/gutenberg/pull/72223
1313
* https://github.com/WordPress/gutenberg/pull/72285
14+
* https://github.com/WordPress/gutenberg/pull/72700
1415
* https://github.com/WordPress/gutenberg/pull/72674
1516
* https://github.com/WordPress/gutenberg/pull/72636

lib/compat/wordpress-6.9/class-gutenberg-rest-static-templates-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class Gutenberg_REST_Static_Templates_Controller extends WP_REST_Templates_Controller {
44
public function __construct() {
5-
$this->rest_base = 'wp_registered_template';
5+
$this->rest_base = 'registered-templates';
66
$this->namespace = 'wp/v2';
77
}
88

lib/compat/wordpress-6.9/template-activate.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
add_filter( 'register_post_type_args', 'gutenberg_modify_wp_template_post_type_args', 10, 2 );
99
function gutenberg_modify_wp_template_post_type_args( $args, $post_type ) {
1010
if ( 'wp_template' === $post_type ) {
11-
$args['rest_base'] = 'wp_template';
11+
$args['rest_base'] = 'created-templates';
1212
$args['rest_controller_class'] = 'WP_REST_Posts_Controller';
1313
$args['autosave_rest_controller_class'] = null;
1414
$args['revisions_rest_controller_class'] = null;
@@ -21,7 +21,8 @@ function gutenberg_modify_wp_template_post_type_args( $args, $post_type ) {
2121
// need to deprecate /templates eventually, but we'll still want to be able
2222
// to lookup the active template for a specific slug, and probably get a list
2323
// of all _active_ templates. For that we can keep /lookup.
24-
add_action( 'rest_api_init', 'gutenberg_maintain_templates_routes' );
24+
// Priority 100, after `create_initial_rest_routes`.
25+
add_action( 'rest_api_init', 'gutenberg_maintain_templates_routes', 100 );
2526

2627
/**
2728
* @global array $wp_post_types List of post types.
@@ -61,7 +62,7 @@ function gutenberg_maintain_templates_routes() {
6162
$wp_post_types['wp_template']->autosave_rest_controller_class = $original_autosave_rest_controller_class;
6263
$wp_post_types['wp_template']->revisions_rest_controller_class = $original_revisions_rest_controller_class;
6364
// Restore the original base.
64-
$wp_post_types['wp_template']->rest_base = 'wp_template';
65+
$wp_post_types['wp_template']->rest_base = 'created-templates';
6566

6667
// Register the old routes.
6768
$autosaves_controller->register_routes();

packages/core-data/src/entities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export const rootEntitiesConfig = [
207207
label: __( 'Registered Templates' ),
208208
name: 'registeredTemplate',
209209
kind: 'root',
210-
baseURL: '/wp/v2/wp_registered_template',
210+
baseURL: '/wp/v2/registered-templates',
211211
key: 'id',
212212
},
213213
];

0 commit comments

Comments
 (0)