Title: Execution time
Last modified: March 19, 2026

---

# Execution time

 *  Resolved [islp](https://wordpress.org/support/users/islp/)
 * (@islp)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/)
 * When I use this in my plugin, is there something that guarantees that WP Logger
   is loaded before I use it? Should I check if it is loaded and active?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [igortron](https://wordpress.org/support/users/igortron/)
 * (@igortron)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18856940)
 * Hey, [@islp](https://wordpress.org/support/users/islp/)! Good question.
 * Since the hook is part of the plugin, you can use it after the plugin has been
   initialized. This means you need to ensure your calls are executed after the `
   plugins_loaded` hook is triggered.
 *  Thread Starter [islp](https://wordpress.org/support/users/islp/)
 * (@islp)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857011)
 * [@igortron](https://wordpress.org/support/users/igortron/) ok, but I’m not sure
   this covers all the possible scenarios (that is maybe my plugin under some circumstances
   fires before all the plugins are loaded)
 *  [igortron](https://wordpress.org/support/users/igortron/)
 * (@igortron)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857439)
 * Got it. That is exactly what WP hooks were created for.
 * When you definitely call it before `plugins_loaded` fired, you have to hook on
   it
 *     ```wp-block-code
       add_action( 'plugins_loaded', function() {   do_action( 'logger' );} );
       ```
   
 * But if you arn’t sure whether your call runs before or after it, you could add
   an extra check
 *     ```wp-block-code
       $do_log = function () {  do_action( 'logger' );};// Check if the action 'plugins_loaded' has not been fired,// then perform logging on this action.if ( ! did_action( 'plugins_loaded' ) ) {	add_action( 'plugins_loaded', $do_log );} else {	$do_log();}
       ```
   
 *  Thread Starter [islp](https://wordpress.org/support/users/islp/)
 * (@islp)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857442)
 * [@igortron](https://wordpress.org/support/users/igortron/) Interesting solution,
   thanks 🙂
 *  [igortron](https://wordpress.org/support/users/igortron/)
 * (@igortron)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857443)
 * Another option is to turn this Logger into a [“must use” plugin](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/).
   That way, its API becomes available before any regular plugins are loaded.
 *  Thread Starter [islp](https://wordpress.org/support/users/islp/)
 * (@islp)
 * [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857444)
 * [@igortron](https://wordpress.org/support/users/igortron/) This is what I’ve 
   done recently for my plugins: I have many custom plugins in the same website 
   and ANY plugin uses a bunch of identical static methods. I moved any methods 
   to mu-plugins and removed the local copies in any single custom plugin directory(
   avoided duplication)
    -  This reply was modified 2 months ago by [islp](https://wordpress.org/support/users/islp/).

Viewing 6 replies - 1 through 6 (of 6 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexecution-time-3%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wp-data-logger/assets/icon-128x128.png?rev=1934745)
 * [WP Logger](https://wordpress.org/plugins/wp-data-logger/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-logger/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-logger/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-logger/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-logger/reviews/)

## Tags

 * [execution](https://wordpress.org/support/topic-tag/execution/)
 * [load](https://wordpress.org/support/topic-tag/load/)
 * [time](https://wordpress.org/support/topic-tag/time/)

 * 6 replies
 * 2 participants
 * Last reply from: [islp](https://wordpress.org/support/users/islp/)
 * Last activity: [2 months ago](https://wordpress.org/support/topic/execution-time-3/#post-18857444)
 * Status: resolved