WordPress Logging Service
Overcoming plugin load order? (2 posts)

  1. Stanislav Khromov
    Posted 2 years ago #

    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?


  2. Stanislav Khromov
    Posted 2 years ago #

    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;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Logging Service
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.