Make WordPress Core


Ignore:
Timestamp:
05/27/2016 07:19:12 PM (8 years ago)
Author:
jorbin
Message:

Bootstrap/Load: Load plugin.php earlier in wp-settings.php

In order to allow non-web initializations of WordPress (such as through wp-cli) to modify things like the check for maintenance mode, plugins.php and the associated functions must be available much earlier. The use of these functions earlier than the loading of plugins is not recommended in most use cases.

Fixes #36819. See #34936.
Props jorbin, danielbachhuber for documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-settings.php

    r37572 r37588  
    2121require( ABSPATH . WPINC . '/load.php' );
    2222require( ABSPATH . WPINC . '/default-constants.php' );
     23require( ABSPATH . WPINC . '/plugin.php' );
    2324
    2425/*
     
    7172
    7273// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
    73 if ( WP_CACHE )
     74if ( WP_CACHE ) {
     75    _backup_plugin_globals();
    7476    WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
     77    _restore_plugin_globals();
     78}
    7579
    7680// Define WP_LANG_DIR if not set.
     
    8286require( ABSPATH . WPINC . '/class-wp.php' );
    8387require( ABSPATH . WPINC . '/class-wp-error.php' );
    84 require( ABSPATH . WPINC . '/plugin.php' );
    8588require( ABSPATH . WPINC . '/pomo/mo.php' );
    8689
Note: See TracChangeset for help on using the changeset viewer.