Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backport-changelog/6.9/8063.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ https://github.com/WordPress/wordpress-develop/pull/8063
* https://github.com/WordPress/gutenberg/pull/72141
* https://github.com/WordPress/gutenberg/pull/72223
* https://github.com/WordPress/gutenberg/pull/72285
* https://github.com/WordPress/gutenberg/pull/72700
* https://github.com/WordPress/gutenberg/pull/72674
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Gutenberg_REST_Static_Templates_Controller extends WP_REST_Templates_Controller {
public function __construct() {
$this->rest_base = 'wp_registered_template';
$this->rest_base = 'registered-templates';
$this->namespace = 'wp/v2';
}

Expand Down
7 changes: 4 additions & 3 deletions lib/compat/wordpress-6.9/template-activate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
add_filter( 'register_post_type_args', 'gutenberg_modify_wp_template_post_type_args', 10, 2 );
function gutenberg_modify_wp_template_post_type_args( $args, $post_type ) {
if ( 'wp_template' === $post_type ) {
$args['rest_base'] = 'wp_template';
$args['rest_base'] = 'created-templates';
$args['rest_controller_class'] = 'WP_REST_Posts_Controller';
$args['autosave_rest_controller_class'] = null;
$args['revisions_rest_controller_class'] = null;
Expand All @@ -21,7 +21,8 @@ function gutenberg_modify_wp_template_post_type_args( $args, $post_type ) {
// need to deprecate /templates eventually, but we'll still want to be able
// to lookup the active template for a specific slug, and probably get a list
// of all _active_ templates. For that we can keep /lookup.
add_action( 'rest_api_init', 'gutenberg_maintain_templates_routes' );
// Priority 100, after `create_initial_rest_routes`.
add_action( 'rest_api_init', 'gutenberg_maintain_templates_routes', 100 );

/**
* @global array $wp_post_types List of post types.
Expand Down Expand Up @@ -61,7 +62,7 @@ function gutenberg_maintain_templates_routes() {
$wp_post_types['wp_template']->autosave_rest_controller_class = $original_autosave_rest_controller_class;
$wp_post_types['wp_template']->revisions_rest_controller_class = $original_revisions_rest_controller_class;
// Restore the original base.
$wp_post_types['wp_template']->rest_base = 'wp_template';
$wp_post_types['wp_template']->rest_base = 'created-templates';

// Register the old routes.
$autosaves_controller->register_routes();
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const rootEntitiesConfig = [
label: __( 'Registered Templates' ),
name: 'registeredTemplate',
kind: 'root',
baseURL: '/wp/v2/wp_registered_template',
baseURL: '/wp/v2/registered-templates',
key: 'id',
},
];
Expand Down
Loading