Make WordPress Core

Changeset 59885


Ignore:
Timestamp:
02/27/2025 11:08:10 PM (13 hours ago)
Author:
peterwilsoncc
Message:

Editor: Set new default rendering mode for Pages.

This update updates the page post-type definition and sets template-locked as the new default rendering mode for the block editor.

Props mamaduka, wildworks, joemcgill, tyb, swissspidy, audrasjb.
Fixes #61811.

Location:
trunk
Files:
2 edited

Legend:

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

    r59784 r59885  
    6969        )
    7070    );
     71
     72    // Enhance page editor for block themes by rendering template and content blocks.
     73    if ( wp_is_block_theme() && current_theme_supports( 'block-templates' ) ) {
     74        add_post_type_support( 'page', 'editor', array( 'default-mode' => 'template-locked' ) );
     75    }
    7176
    7277    register_post_type(
  • trunk/tests/phpunit/tests/option/networkOption.php

    r58811 r59885  
    382382     */
    383383    public function test_get_network_option_does_not_use_single_site_notoptions_cache_for_networks() {
     384        $network_notoptions_cache_before     = wp_cache_get( '1:notoptions', 'site-options' );
     385        $single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' );
     386
    384387        get_network_option( 1, 'ticket_61730_notoption' );
    385388
    386         $network_notoptions_cache     = wp_cache_get( '1:notoptions', 'site-options' );
    387         $single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' );
    388 
    389         $this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' );
    390         $this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' );
    391         $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' );
     389        $network_notoptions_cache_after     = wp_cache_get( '1:notoptions', 'site-options' );
     390        $single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' );
     391
     392        $this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' );
     393        $this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' );
     394        $this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' );
     395        $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' );
    392396    }
    393397
     
    403407     */
    404408    public function test_delete_network_option_does_not_use_single_site_notoptions_cache_for_networks() {
     409        $network_notoptions_cache_before     = wp_cache_get( '1:notoptions', 'site-options' );
     410        $single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' );
     411
    405412        add_network_option( 1, 'ticket_61730_notoption', 'value' );
    406413        delete_network_option( 1, 'ticket_61730_notoption' );
    407414
    408         $network_notoptions_cache     = wp_cache_get( '1:notoptions', 'site-options' );
    409         $single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' );
    410 
    411         $this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' );
    412         $this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' );
    413         $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' );
     415        $network_notoptions_cache_after     = wp_cache_get( '1:notoptions', 'site-options' );
     416        $single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' );
     417
     418        $this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' );
     419        $this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' );
     420        $this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' );
     421        $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' );
    414422    }
    415423}
Note: See TracChangeset for help on using the changeset viewer.