WordPress debugging and how to do it

WordPress | on Apr. 02, 2011 | by 0 Comments

Debugging is not a new term to many internet users and especially webmasters and web designers. Programmers will tell you that there is no perfect program without any errors. WordPress is no exception to this rule and every now and then, an error will occur necessitating the need to debug. Debugging is a very important process especially for people running blogs and websites. Constant errors on your blog or site reflect poorly on you as a designer and webmaster and they could make you lose out on traffic and important visitors. WordPress has very many features and tools for debugging. To make your debugging process easier, this article gives you some of the simple ways in which you can debug your site.

WP_Debug is the first tool and it offers you the opportunity to switch to the debug mode in your WordPress blog. On defining WP_Debug on wp.config.php, you get WordPress generated debug messages and PHP notices especially on diminishing function. It also has further functionalities such as WP_Debug_Display and WP_Debug_Log. These enable you to log to a wp-content/debug.log file. You can even use it on a live site as long as you are logged on. WP_Debug will enable you to capture potential problems on your blog and especially your code for example unchecked indexes and variables that are not defined. It may even capture problems on WordPress itself which are supposed to be reported in ‘file a bug report’.

Script_Debug is another mode of debugging on WordPress. Usually, WordPress will minimize and systematically arrange JavaScript and CSS. It will also have development scripts which appear in the dev.js and dev.css formats. To be able to debug this scripts you use define (‘SCRIPT_DEBUG’, true);

The ‘shutdown’ and ‘all’ hooks is a way of debugging that uses the two hooks mentioned; the ‘all’ and ‘shutdown’ hook. The ‘all’ hook fires for all filters and actions. It executes numerous hooks on every page of the blog and it is superb in identifying the right hook and also for troubleshooting. The ‘shutdown’ hook on the other hand is usually the last hook to run after all the ‘all’ hooks have run. It can be used in conjunction with other debugging modes such as ‘write the query information to the database’ and ‘SAVEQUERIES’.

SAVEQUERIES mentioned above is a debugging method that serves to instruct the WordPress database class to store or save the query history. It is defined by “define (‘SAVEQUERIES’, true);” After this definition, $wpdb->queries is able to store a wide range of queries that were carried out together with the time that was taken to carry them out. In addition, the database class will have other debugging tools to ensure proper function.

Lastly, there is Core Control debugging method which utilizes plugins. As is the case with all WordPress plugins, there are numerous debugging plugins available but it would be worth mentioning the Dion Hulse’s Core Control plug-in. With its five debugging modules covering HTTP methods, Cron tasks, Filesystem methods, HTTP logging and upgrades, this plug-in is definitely a must have in your list of debugging tools.

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks

Leave Your Response

* Name, Email, Comment are Required