Skip to content

Debugging WordPress issues

WordPress provides several built‑in settings that help you debug themes, plugins, and custom code. These tools are intended for developers but can also be useful when troubleshooting problems on your site hosted with ruachost.com.

  • Identify PHP errors, notices, and warnings.
  • Troubleshoot plugin or theme conflicts.
  • Log database queries for performance analysis.
  • Test modifications to CSS/JS files.
  • Log in via cPanel File Manager or SSH.

  • Open the wp-config.php file in your WordPress root directory.

  • Add the following line:

    define('WP_DEBUG', true);
  • Save changes.

  • WordPress will now display PHP errors, notices, and warnings directly on your site.

⚠️ Important: Disable debugging when finished by setting:

define('WP_DEBUG', false);
  • To log errors instead of displaying them:

    define('WP_DEBUG_LOG', true);
  • Errors will be saved to wp-content/debug.log.

  • Useful for production sites where you don’t want visitors to see error messages.

  • To hide errors from visitors while still logging them:

    define('WP_DEBUG_DISPLAY', false);
  • To test uncompressed versions of WordPress core CSS/JS files:

    define('SCRIPT_DEBUG', true);
  • Useful when modifying or troubleshooting built‑in scripts.

  • To log all database queries:

    define('SAVEQUERIES', true);
  • Queries are stored in the global $wpdb->queries array.

  • Example to dump queries:

    global $wpdb;
    print_r($wpdb->queries);

⚠️ Note: This can slow down your site, only enable temporarily.

  • Always disable debugging after troubleshooting.
  • Never leave WP_DEBUG enabled on a live site.
  • Use logs to identify recurring issues.
  • Back up your site before making changes.