Support » Plugin: WordPress Logging Service » Overcoming plugin load order?

  • I’m trying to implement WLS support in another plugin, but there is an issue – WLS is loaded after my plugin.

    So, for example to add a category I have to do this:

    add_action( 'plugins_loaded', array( &$this, 'register_logging' ));
    function register_logging()
    		wls_register( 'Posts Importer', 'Posts importer logs');

    So now my category works but I can’t log anything because wls_log() is not defined when I call it in my plugin.

    So how would I call wls_log() and ensure that it is actually loaded?

Viewing 1 replies (of 1 total)
  • So one solution I have found is to delay loading of your plugin until after the ‘plugins_loaded’ hook. But I really don’t like this solution – it seems very hacky. Hoping for an alternative.

    Here’s the code.

    /* Makes sure the plugin loads dead last so it can use WLS logging. */
    $your_plugin = new Your_Plugin();
    function your_plugin_load_plugin_last()
    	//Init your plugin here
    	global $your_plugin;

Viewing 1 replies (of 1 total)
  • The topic ‘Overcoming plugin load order?’ is closed to new replies.