WordPress.org

Make WordPress Core

Ticket #45861: 45861.patch

File 45861.patch, 1.5 KB (added by rilwis, 2 years ago)

Proposed patch

  • src/wp-includes/plugin.php

     
    726726}
    727727
    728728/**
     729 * Load plugin main file.
     730 *
     731 * Using a function prevents global variable created in the plugin main file.
     732 *
     733 * @param  string $file Known path to the file.
     734 * @return void
     735 */
     736function wp_load_plugin( $file ) {
     737        include_once( $file );
     738}
     739
     740/**
    729741 * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in.
    730742 *
    731743 * @since 2.8.0
  • src/wp-settings.php

     
    275275
    276276// Load must-use plugins.
    277277foreach ( wp_get_mu_plugins() as $mu_plugin ) {
    278         include_once( $mu_plugin );
     278        wp_load_plugin( $mu_plugin );
    279279
    280280        /**
    281281         * Fires once a single must-use plugin has loaded.
     
    292292if ( is_multisite() ) {
    293293        foreach ( wp_get_active_network_plugins() as $network_plugin ) {
    294294                wp_register_plugin_realpath( $network_plugin );
    295                 include_once( $network_plugin );
     295                wp_load_plugin( $network_plugin );
    296296
    297297                /**
    298298                 * Fires once a single network-activated plugin has loaded.
     
    339339// Load active plugins.
    340340foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
    341341        wp_register_plugin_realpath( $plugin );
    342         include_once( $plugin );
     342        wp_load_plugin( $plugin );
    343343
    344344        /**
    345345         * Fires once a single activated plugin has loaded.