Plugins: Introduce actions for individual plugin load events:

* `plugin_loaded`: Fires once a single activated plugin has loaded.
* `mu_plugin_loaded`: Fires once a single must-use plugin has loaded.
* `network_plugin_loaded`: Fires once a single network-activated plugin has loaded.

Props Rarst, schlessera.
Fixes #41346.
Built from https://develop.svn.wordpress.org/trunk@44344


git-svn-id: http://core.svn.wordpress.org/trunk@44174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-12-20 00:52:48 +00:00
parent 2a3473e0de
commit e3bb408fbd
2 changed files with 28 additions and 1 deletions

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-alpha-44343';
$wp_version = '5.1-alpha-44344';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -276,6 +276,15 @@ $GLOBALS['wp_plugin_paths'] = array();
// Load must-use plugins.
foreach ( wp_get_mu_plugins() as $mu_plugin ) {
include_once( $mu_plugin );
/**
* Fires once a single must-use plugin has loaded.
*
* @since 5.1.0
*
* @param string $mu_plugin Loaded plugin's basename.
*/
do_action( 'mu_plugin_loaded', $mu_plugin );
}
unset( $mu_plugin );
@ -284,6 +293,15 @@ if ( is_multisite() ) {
foreach ( wp_get_active_network_plugins() as $network_plugin ) {
wp_register_plugin_realpath( $network_plugin );
include_once( $network_plugin );
/**
* Fires once a single network-activated plugin has loaded.
*
* @since 5.1.0
*
* @param string $network_plugin Loaded plugin's basename.
*/
do_action( 'network_plugin_loaded', $network_plugin );
}
unset( $network_plugin );
}
@ -322,6 +340,15 @@ register_theme_directory( get_theme_root() );
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
wp_register_plugin_realpath( $plugin );
include_once( $plugin );
/**
* Fires once a single activated plugin has loaded.
*
* @since 5.1.0
*
* @param string $plugin Loaded plugin's basename.
*/
do_action( 'plugin_loaded', $plugin );
}
unset( $plugin );