Make WordPress Core

Changeset 61865


Ignore:
Timestamp:
03/07/2026 06:03:43 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Editor: Correct wp_enable_real_time_collaboration default for REST API sync route.

Follow-up to [61689], [61702], [61722], [61828], [61862], [61864].

Props mindctrl, skithund, amykamala, MadtownLems, aion11, peterwilsoncc, pbiron, apermo, SergeyBiryukov.
Fixes #64814.

Location:
trunk
Files:
2 edited

Legend:

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

    r61833 r61865  
    28932893                        'description'       => __( 'Enable Real-Time Collaboration' ),
    28942894                        'sanitize_callback' => 'rest_sanitize_boolean',
    2895                         'default'           => false,
     2895                        'default'           => true,
    28962896                        'show_in_rest'      => true,
    28972897                )
  • trunk/tests/phpunit/tests/rest-api/rest-sync-server.php

    r61839 r61865  
    9898
    9999        /**
     100         * Verifies the sync route is registered when relying on the option's default
     101         * value (option not stored in the database).
     102         *
     103         * This covers the upgrade scenario where a site has never explicitly saved
     104         * the collaboration setting.
     105         *
     106         * @ticket 64814
     107         */
     108        public function test_register_routes_with_default_option() {
     109                global $wp_rest_server;
     110
     111                // Remove the pre_option filter added in ::set_up() so get_option() uses its default logic.
     112                remove_filter( 'pre_option_wp_enable_real_time_collaboration', '__return_true' );
     113
     114                // Ensure the option is not in the database.
     115                delete_option( 'wp_enable_real_time_collaboration' );
     116
     117                // Reset the REST server so routes are re-registered from scratch.
     118                $wp_rest_server = null;
     119
     120                $routes = rest_get_server()->get_routes();
     121                $this->assertArrayHasKey( '/wp-sync/v1/updates', $routes );
     122        }
     123
     124        /**
    100125         * @doesNotPerformAssertions
    101126         */
Note: See TracChangeset for help on using the changeset viewer.