WPIntell

Source evidence

Execution time

WP Logger · support · 2026-03-19T06:43:00+00:00

mixedsentiment
mediumseverity
0.72relevance
6replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 35 rows with source links

17.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
islp resolved
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? Hey, @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. @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) 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 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 $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(); } @igortron Interesting solution, thanks 🙂 Another option is to turn this Logger into a “must use” plugin . That way, its API becomes available before any regular plugins are loaded. @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, 1 week ago by islp .

Comments

6 shown
igortron 2026-03-19T15:47:00+00:00

Hey, @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.

islp 2026-03-19T16:44:00+00:00

@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 2026-03-20T07:25:00+00:00

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 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 $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(); }

islp 2026-03-20T07:29:00+00:00

@igortron Interesting solution, thanks 🙂

igortron 2026-03-20T07:30:00+00:00

Another option is to turn this Logger into a “must use” plugin . That way, its API becomes available before any regular plugins are loaded.

islp 2026-03-20T07:33:00+00:00

@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, 1 week ago by islp .