Support » Plugins » Hacks » How Do I Debug a Plugin?

  • Resolved b-rad

    (@b-rad)


    I’m trying to get my feet wet and learn how to create a WP plugin but I don’t see any way to get some basic debug info to show up. I’ve set define( ‘WP_DEBUG’, true ); in my wp-config.php file but all I see are messages like:

    The plugin generated 309 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    when I activate my test plugin. How can I get more detail including things like the 309 characters Wp tells me it sees?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Sometimes you can’t get more details, depends on what is causing the error.

    I’d also suggest using define( 'WP_DEBUG_LOG', true ); as well.

    Wow, can’t get more details? That seems pretty limiting. Like trying to code with your hands behind your back. I checked out http://codex.wordpress.org/Editing_wp-config.php which says to try changing the config file to:

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_LOG’, true);
    define(‘WP_DEBUG_DISPLAY’, false);
    @ini_set(‘display_errors’,0);

    but my log file gets no errors. This is frustrating. There has to be a better way to create a plugin, especially one that deals with db tables.

    Progress made. I changed my config file to:

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_LOG’, true);
    define(‘WP_DEBUG_DISPLAY’, true);
    @ini_set(‘display_errors’,0);

    and put a debug.log file in my wp-content folder and made it writable by the web server and now I’m actually catching errors.

    did you manage to solve the issue?

    Yeah, this should do the trick.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How Do I Debug a Plugin?’ is closed to new replies.