Say you have installed WordPress and are trying out some plugin, but the plugin is not working as intended, how do you figure out what is going wrong?

To debug WordPress follow the following 2 steps:

  • Enable WordPress debug.
    To do this, go to WordPress installation root, open the file wp-config.php and change define(‘WP_DEBUG’, false); to define(‘WP_DEBUG’, true);
    Enabling this will force WordPress to print all warning and error message to your WordPress site.
    Warning:Do not do this in a production site. You do not want your end users to see error or warning messages on screen.
  • Enable PHP error logging.
    Open you php.ini file, make sure log_errors variable is uncommented and set to On i.e log_errors = On. Once this is set, make PHP log errors to an error log file using error_log. Mine looks like this error_log = “C:\logs\php_errors.log”. Once done, bounce Apache and you should be on your way to figuring out what is going wrong.
Advertisements