Make WordPress Core


Ignore:
Timestamp:
12/20/2018 12:51:30 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r44150 r44344  
    277277foreach ( wp_get_mu_plugins() as $mu_plugin ) {
    278278    include_once( $mu_plugin );
     279
     280    /**
     281     * Fires once a single must-use plugin has loaded.
     282     *
     283     * @since 5.1.0
     284     *
     285     * @param string $mu_plugin Loaded plugin's basename.
     286     */
     287    do_action( 'mu_plugin_loaded', $mu_plugin );
    279288}
    280289unset( $mu_plugin );
     
    285294        wp_register_plugin_realpath( $network_plugin );
    286295        include_once( $network_plugin );
     296
     297        /**
     298         * Fires once a single network-activated plugin has loaded.
     299         *
     300         * @since 5.1.0
     301         *
     302         * @param string $network_plugin Loaded plugin's basename.
     303         */
     304        do_action( 'network_plugin_loaded', $network_plugin );
    287305    }
    288306    unset( $network_plugin );
     
    323341    wp_register_plugin_realpath( $plugin );
    324342    include_once( $plugin );
     343
     344    /**
     345     * Fires once a single activated plugin has loaded.
     346     *
     347     * @since 5.1.0
     348     *
     349     * @param string $plugin Loaded plugin's basename.
     350     */
     351    do_action( 'plugin_loaded', $plugin );
    325352}
    326353unset( $plugin );
Note: See TracChangeset for help on using the changeset viewer.