How to Debug a WordPress Theme

If you’re tweaking an existing theme or building your own from scratch, you’ll no doubt come to a point in your tinkering when something that you’re trying just doesn’t work. It can be difficult to pinpoint this, particularly if your server is setup to just fail if there is any bunk PHP code.

Luckily, there’s a built in constant to throw your site into “debug” mode. To turn this on:

  1. Using an FTP editor, open your wp-config.php file
  2. Scroll down to the line which reads:
    define('WP_DEBUG', false);
  3. Change the false to true

Make sure to switch it back to false when you’re done, otherwise your site may spit out errors by plugins, or even minor warnings in your own theme development.

Up Next: Pagination Links in WordPress via Functions.php