Recommend a guide to catching plugin errors, please?

I’m working on a small plugin and on some WP installations it throws up the white screen of death.

I’m new to this, and would like to know if there is a decent guide out to there (so far my googling over the white screen of death hasn’t turned up anything for developers), or some best practices I should be following to make sure I catch errors or avoid anything foolish.

Read More

Any and all links or tips would be massively appreciated.

Related posts

Leave a Reply

1 comment

  1. A white screen of death is typically a fatal PHP error, most of the time due to a syntax error. This often sends no errors to the browser.

    Some things you can do:

    Turn on PHP error_log in your php.ini file and set the error_reporting levels.
    http://php.net/manual/en/errorfunc.configuration.php

    Error info: http://www.php.net/manual/en/errorfunc.constants.php

    Alternatively or in combination you can turn this on in your wp-config as well (from wordpress codex).
    http://codex.wordpress.org/Editing_wp-config.php

    /**
     * This will log all errors notices and warnings to a file called debug.log in
     * wp-content only when WP_DEBUG is true
     */
    
    define('WP_DEBUG', true); // false
    if (WP_DEBUG) {
      define('WP_DEBUG_LOG', true);
      define('WP_DEBUG_DISPLAY', false);
      @ini_set('display_errors',0);
    }
    

    Turn on WordPress debugging and saved queries, (wp debug is same as above example) in your wp-config.php.

    define('WP_DEBUG', true);
    define('SAVEQUERIES', true);
    

    And install the debug bar, http://wordpress.org/extend/plugins/debug-bar/

    I also recommend using something like xDebug,