-
-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
I'd like to help users to track down culprits.
Copied from the venerable https://github.com/wp-cli/profile-command
qm-profiling.php
<?php
$qm_profiling_stage_hooks = [
'bootstrap' => [
'muplugins_loaded',
'plugins_loaded',
'setup_theme',
'after_setup_theme',
'init',
'wp_loaded',
],
'main_query' => [
'parse_request',
'send_headers',
// 'pre_get_posts',
'the_posts',
'wp',
],
'template' => [
'template_redirect',
'template_include',
'wp_head',
'loop_start',
'loop_end',
'wp_footer',
],
];
foreach ($qm_profiling_stage_hooks as $stage => $hooks) {
foreach ($hooks as $hook) {
add_filter(
$hook,
static function ($value) use ($stage, $hook) {
do_action('qm/start', sprintf('%s/%s', $stage, $hook));
return $value;
},
PHP_INT_MIN,
1
);
add_filter(
$hook,
static function ($value) use ($stage, $hook) {
do_action('qm/stop', sprintf('%s/%s', $stage, $hook));
return $value;
},
PHP_INT_MAX,
1
);
}
}
How to go on?
Metadata
Metadata
Assignees
Labels
No labels