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.

 

Why Enable Debugging?

  • Identify PHP errors, notices, and warnings.

  • Troubleshoot plugin or theme conflicts.

  • Log database queries for performance analysis.

  • Test modifications to CSS/JS files.

 

Steps to Enable Debugging

1. Enable Basic Debugging Mode

  • 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);

2. Enable Debug Logging

  • 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.

 

3. Control Error Display

  • To hide errors from visitors while still logging them:

    define('WP_DEBUG_DISPLAY', false);
    

4. Enable Script Debugging

  • To test uncompressed versions of WordPress core CSS/JS files:

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

 

5. Log Database Queries

  • 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.

 

Best Practices

  • 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.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)

Powered by WHMCompleteSolution