[wp-trac] [WordPress Trac] #41346: Introduce a hook for individual plugin loaded
WordPress Trac
noreply at wordpress.org
Mon Jul 17 16:16:37 UTC 2017
#41346: Introduce a hook for individual plugin loaded
-----------------------------+-----------------------------
Reporter: Rarst | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: trunk
Severity: normal | Keywords:
Focuses: performance |
-----------------------------+-----------------------------
The current plugin load during core boot is essentially a series of
`include` firing:
{{{#!php
// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
wp_register_plugin_realpath( $plugin );
include_once( $plugin );
}
unset( $plugin );
}}}
Currently it is ''exceptionally'' hard to fire off arbitrary code between
these includes. The closest I got over years is the following code, which
I consider highly unstable:
https://gist.github.com/Rarst/c32575ffc26df59a45c0
Distinguishing between load events of individual plugins is highly
desirable for performance troubleshooting. In current state it is defacto
impossible to troubleshoot with PHP code, requiring manual toggling of
plugins or low level PHP profiler set up.
Adding individual plugin load event will make it '''much''' easier to
profile and diagnose performance issues at this load stage.
Can be as simple as:
{{{#!php
include_once( $plugin );
do_action( 'plugin_loaded', $plugin );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41346>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list