WordPress.org

Make WordPress Core

Ticket #43882: 43882.diff

File 43882.diff, 1.1 KB (added by schlessera, 19 months ago)

Initial implementation (with simple & naïve plugin name detection)

  • src/wp-settings.php

    diff --git src/wp-settings.php src/wp-settings.php
    index eb632238f0..c0721e8fc8 100644
    register_theme_directory( get_theme_root() ); 
    304304// Load active plugins.
    305305foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
    306306        wp_register_plugin_realpath( $plugin );
    307         include_once( $plugin );
     307
     308        // Pre action to allow for timing hooks to be set, debugging information to
     309        // be initialized, etc...
     310        // Can also allow for the loading to be skipped.
     311        $should_load = apply_filters( 'pre_plugin_loaded', $plugin );
     312
     313        // Actually load the plugin if this is still requested.
     314        $should_load && include_once( $plugin );
     315
     316        // Post action to catch timings, debugging state, etc...
     317        do_action( 'post_plugin_loaded', $plugin );
     318
     319        // Singular plugin load action that fires for each individual plugin.
     320        do_action( 'plugin_loaded', $plugin );
     321
     322        // Named action to make behavior of plugins dependent on the loading of
     323        // other plugins.
     324        $plugin_slug = basename( $plugin, '.php' );
     325        do_action( "plugin_loaded_{$plugin_slug}", $plugin );
    308326}
    309327unset( $plugin );
    310328