From e3bb408fbd26617aaab7061f492f432a5201fc8a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 20 Dec 2018 00:52:48 +0000 Subject: [PATCH] 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 --- wp-includes/version.php | 2 +- wp-settings.php | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 0e2d29e37e..44f5120cc4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-settings.php b/wp-settings.php index 4f15f0edc2..ca7d0b1a14 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -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 );