Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Created November 6, 2025 18:48
Show Gist options
  • Select an option

  • Save georgestephanis/3e55eb82bd4c63b817fd4db9ce07541b to your computer and use it in GitHub Desktop.

Select an option

Save georgestephanis/3e55eb82bd4c63b817fd4db9ce07541b to your computer and use it in GitHub Desktop.
<?php
// Plugin Name: George Load Time Debugging
function qm_track_current_action( $suffix = '' ) {
static $last_action = null;
if ( $last_action ) {
do_action( 'qm/stop', $last_action );
}
if ( function_exists( 'current_action' ) ) {
$last_action = current_action() . ( $suffix ? ' : ' . str_replace( WP_CONTENT_DIR, '', $suffix ) : '' );
} else {
$last_action = 'unknown action';
}
do_action( 'qm/start', $last_action );
}
add_action( 'mu_plugins_loaded', 'qm_track_current_action' );
add_action( 'mu_plugin_loaded', 'qm_track_current_action' );
add_action( 'network_plugin_loaded', 'qm_track_current_action' );
add_action( 'plugin_loaded', 'qm_track_current_action' );
add_action( 'setup_theme', 'qm_track_current_action' );
add_action( 'after_setup_theme', 'qm_track_current_action' );
add_action( 'init', 'qm_track_current_action' );
add_action( 'wp_loaded', 'qm_track_current_action' );
add_action( 'parse_request', 'qm_track_current_action' );
add_action( 'wp', 'qm_track_current_action' );
add_action( 'template_redirect', 'qm_track_current_action' );
add_action( 'wp_footer', 'qm_track_current_action' );
add_action( 'adminmenu', 'qm_track_current_action' );
add_action( 'admin_footer', 'qm_track_current_action' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment