Make WordPress Core


Ignore:
Timestamp:
11/07/2025 12:41:01 PM (3 months ago)
Author:
ellatrix
Message:

Revert template activation.

This commit reverts the PHP changes that were made to support the template activation feature. The UI was already reverted through the packages sync in [61177] (Gutenberg PR: https://github.com/WordPress/gutenberg/pull/73025).

Developed in https://github.com/WordPress/wordpress-develop/pull/10473.

Fixes #64214.
Props ellatrix, t-hamano, mcsf, ramonjd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php

    r61029 r61178  
    590590        $autosave_db_post = get_post( $autosave_post_id );
    591591        $request          = new WP_REST_Request( 'GET', '/wp/v2/' . $rest_base . '/' . $template_id . '/autosaves/' . $autosave_db_post->ID );
    592         // See create_initial_rest_routes. The controller need the post type
    593         // with adjusted settings to initialize.
    594         global $wp_post_types;
    595         $wp_post_types['wp_template']->rest_base                       = 'templates';
    596         $original_rest_controller_class                                = $wp_post_types['wp_template']->rest_controller_class;
    597         $original_revisions_rest_controller_class                      = $wp_post_types['wp_template']->revisions_rest_controller_class;
    598         $wp_post_types['wp_template']->rest_controller_class           = 'WP_REST_Templates_Controller';
    599         $wp_post_types['wp_template']->revisions_rest_controller_class = 'WP_REST_Template_Revisions_Controller';
    600         $wp_post_types['wp_template']->rest_controller                 = null;
    601         $wp_post_types['wp_template']->revisions_rest_controller       = null;
    602         $controller = new WP_REST_Template_Autosaves_Controller( $parent_post->post_type );
    603         $wp_post_types['wp_template']->rest_controller_class           = $original_rest_controller_class;
    604         $wp_post_types['wp_template']->revisions_rest_controller_class = $original_revisions_rest_controller_class;
    605         $wp_post_types['wp_template']->rest_base                       = 'wp_template';
    606         $response = $controller->prepare_item_for_response( $autosave_db_post, $request );
     592        $controller       = new WP_REST_Template_Autosaves_Controller( $parent_post->post_type );
     593        $response         = $controller->prepare_item_for_response( $autosave_db_post, $request );
    607594        $this->assertInstanceOf(
    608595            WP_REST_Response::class,
Note: See TracChangeset for help on using the changeset viewer.