Changeset 61078 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 10/28/2025 01:34:00 PM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/rest-api.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r61045 r61078 264 264 */ 265 265 function create_initial_rest_routes() { 266 global $wp_post_types;267 268 // Register the registered templates endpoint. For that we need to copy the269 // wp_template post type so that it's available as an entity in core-data.270 $wp_post_types['wp_registered_template'] = clone $wp_post_types['wp_template'];271 $wp_post_types['wp_registered_template']->name = 'wp_registered_template';272 $wp_post_types['wp_registered_template']->rest_base = 'wp_registered_template';273 $wp_post_types['wp_registered_template']->rest_controller_class = 'WP_REST_Registered_Templates_Controller';274 275 266 foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) { 276 267 $controller = $post_type->get_rest_controller(); … … 298 289 } 299 290 } 291 292 global $wp_post_types; 300 293 301 294 // Register the old templates endpoints. The WP_REST_Templates_Controller … … 304 297 // To maintain backward and changes to these controller classes, we make use 305 298 // that the wp_template post type has the right information it needs. 299 $current_wp_template_rest_base = $wp_post_types['wp_template']->rest_base; 306 300 $wp_post_types['wp_template']->rest_base = 'templates'; 307 301 // Store the classes so they can be restored. … … 329 323 $wp_post_types['wp_template']->revisions_rest_controller_class = $original_revisions_rest_controller_class; 330 324 // Restore the original base. 331 $wp_post_types['wp_template']->rest_base = 'wp_template';325 $wp_post_types['wp_template']->rest_base = $current_wp_template_rest_base; 332 326 333 327 // Register the old routes. … … 356 350 ) 357 351 ); 352 353 // Registered templates. 354 $controller = new WP_REST_Registered_Templates_Controller(); 355 $controller->register_routes(); 358 356 359 357 // Post types.
Note: See TracChangeset
for help on using the changeset viewer.