Make WordPress Core


Ignore:
Timestamp:
04/16/2016 07:47:14 PM (9 years ago)
Author:
jeremyfelt
Message:

Options: Do not set network options to autoload in single site

When multisite is not configured, the _site_transient() and _site_option() functions fallback to _option() and store network "meta/options" in wp_options.

Previously, those calls to _option() did not explicitly set the autoload parameter and anything assigned as a transient or option at the network level would be set to autoload by default, even though autoload is not yet a concept at the network option level.

This changes that behavior and forces the autoload setting to no. If autoload is desired, the single site option functions should be used.

Props thomaswm.
Fixes #22846.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/option/siteTransient.php

    r34767 r37223  
    4242        $this->assertTrue( delete_site_transient( $key ) );
    4343    }
     44
     45    /**
     46     * @ticket 22846
     47     */
     48    public function test_set_site_transient_is_not_stored_as_autoload_option() {
     49        $key = rand_str();
     50
     51        if ( is_multisite() ) {
     52            $this->markTestSkipped( 'Does not apply when used in multisite.' );
     53        }
     54        set_site_transient( $key, 'Not an autoload option' );
     55
     56        $options = wp_load_alloptions();
     57
     58        $this->assertFalse( isset( $options[ '_site_transient_' . $key ] ) );
     59    }
    4460}
Note: See TracChangeset for help on using the changeset viewer.