Kent Wynn Kent Wynn
  • Frontend Lang
    • HTML +
    • CSS SCSS LESS +
    • JavaScript ES6 TS
    • RxJS Library
    • Angular Framework
    • Ionic Framework
    • JavaFX Framework
    • Java Spring Framework
  • Frontend Dev
  • WordPress
  • UI/UX Designs
  • SEO
  • Tech Follows
Kent Wynn's Promotion Card
  • Kent Wynn’s Shop$10
  • My Account
  • Cart
  • Checkout
544
393
844
20K
0
Kent Wynn Kent Wynn

Software Engineer | UI/UX & Frontend Architect

Become Frontend Master
Kent Wynn Kent Wynn
  • Frontend Lang
    • HTML +
    • CSS SCSS LESS +
    • JavaScript ES6 TS
    • RxJS Library
    • Angular Framework
    • Ionic Framework
    • JavaFX Framework
    • Java Spring Framework
  • Frontend Dev
  • WordPress
  • UI/UX Designs
  • SEO
  • Tech Follows
  • WordPress

How To Debug WordPress: A Complete Beginner’s Guide

  • August 25, 2021
  • 2.1K views
  • 6 minute read
how-to-debug-wordpress-a-complete-beginners-guide
Total
0
Shares
0
0
0
0
0
0
0
0
Table of Contents Hide
  1. What does debugging mean?
  2. 7 WordPress debugging tips
    1. 1. Enable WP_DEBUG
    2. 2. Enable WPDP Error Reporting
    3. 3. Check Error Logs on Website
    4. 4. Use WordPress Staging Environment when tweaking code 
    5. 5. Enable SCRIPT_DEBUG
    6. 6. PHP Error Detection
    7. 7. Leverage Some Debug Tools
  3. Conclusion
  4. Top Ranking WordPress & Web Hostings in 2021

There is no such thing as perfect code, and every webmaster's nightmare comes with a slow website or plugin error. Today, we will show you how to debug WordPress that will help you solve problems that are happening on WordPress.

What does debugging mean?

Debugging, or in short, debugging means identifying and removing bugs or errors in the code. The final step of debugging is to check the code is correct and make sure the problem doesn't happen again.

This is mainly done by programmers. They use tools to debug and this process is common in the software and application development phase.

Debugging strategies during debugging include unit testing, code preview, and pair programming.

So before the code or software is published to the users, the developer will try to find the problem, then isolate and fix it.

Sometimes, fixing code can be a real headache, as it can take longer than writing the code.

7 WordPress debugging tips

When a WordPress site crashes or gets a white screen of death (WSoD), a common fix is ​​deactivating the plugin/ theme and checking for updates again.

Although this helps narrow down the cause. This can be time-consuming, inefficient, and you can also ignore the real problem. That's why the right tools can be worthwhile.

1. Enable WP_DEBUG

Enabling WP-DEBUG is probably the simplest way to log crashes on a WordPress site. But unfortunately, some developers don't do this, most likely because they forgot this feature exists.

WP_DEBUG is a constant that enables the “debug” mode in WordPress. You can find it in the wp-config.php file. This log can record all the activities on the website and help you to troubleshoot any problems.

2. Enable WPDP Error Reporting

To detect any database-related problems, you can enable WPDP error reporting.

The global $wpdb object has a variable called $show_errors . And if you set it to true, you can make WordPress output SQL errors to the screen.

To enable this, go to /public_html/wp-includes/wp-db.php and open the file. Search for wpdb class and change the $show_errors variable to true.

Enable WPDP Error Reporting Debug Wordpress

3. Check Error Logs on Website

Occasionally, you may encounter a server error page while browsing the web. And to troubleshoot such problems, you can review your website error logs.

Checking the general log will help both newbies and developers spot page issues.

4. Use WordPress Staging Environment when tweaking code 

If you want to minimize bugs on your WordPress site, you can deploy the code first on your staging website.

A staging website is almost an exact replica of your running website. It can be hosted on its own private subdomain so as not to affect the commercial version. This site acts as a code testing platform, and you can push it to the official website when it's done.

This environment is mainly not visible to visitors and search engines. So you are free to tweak, improve and test the changes you want. As a result, you will not affect the running pages.

5. Enable SCRIPT_DEBUG

By default, WordPress uses minified versions of CSS and JavaScript files to help improve website load times. However, this can be a problem as it can hide errors in the scripts/plugins you use.

To change script execution, WordPress also provides a constant that we can add to the wp-config.php file, that is:

define ( 'SCRIPT_DEBUG' , true ); 

When the value is set to true, WordPress will automatically load the non-minified versions of all CSS and JavaScript files, making the plugin use the full version.

Enable SCRIPT_DEBUG

6. PHP Error Detection

You can detect PHP errors in your scripts early with phpinfo. This file can output information about the current state of PHP. These include a compiler, extension, version, environment, OS version, HTTP headers, and license options.

To do this, you can configure the php.ini file to enable error reporting. However, some hosting services, including Bluehost‘s shared hosting plan, disable this option.

That's because you don't have root access to enable this feature.

However, you can use a PHP code checker instead. It supports the simple to look for errors in the code. And for a more thorough evaluation, you can also use IDEs like Eclipse or PHPStorm.

7. Leverage Some Debug Tools

If you need simplicity when tracking errors on your WordPress site, use WordPress debugging plugins.

1. Query Monitor

Query Monitor

This plugin provides a developer tool panel on WordPress. You can enable database queries, PHP errors, HTTP API calls, hooks & actions, stop editor blocks, enqueued scripts & stylesheets, etc.

Alternatively, you can also use the Debug Bar and Simply Show Hooks to debug your WordPress site. However, these two plugins may have compatibility issues with the latest WordPress version.

2. New Relic

New Relic

You can also use a more powerful WordPress debugging tool with the Premium tool New Relic. This application helps you to monitor user experience, map WordPress architecture, analyze and improve site performance, and detect anomalies before it happens.

All of those features will help you collect data for troubleshooting. It helps you give your visitors the best possible experience. You can try New Relic for free for 14 days.

Conclusion

Those are all the tips you need to know about debugging WordPress websites. As a developer, you need to identify and fix issues before pushing any code/plugins to users. As a webmaster, you can also use debugging tools to determine what's causing your site's performance problems.

To debug a WordPress site, you can do the following:

  • Enable WP_DEBUG
  • Enable WPDP Error Reporting
  • Check Error Logs on Website
  • Use WordPress Staging Environment when tweaking code
  • Enable SCRIPT_DEBUG
  • PHP Error Detection
  • Use a Debugging Tool like Query Monitor or New Relic

Good luck with your WordPress debugging. We hope you can minimize issues to ensure a seamless visitor experience.

Top Ranking WordPress & Web Hostings in 2021

The ranking is based on our statistics and researches for the year 2021. The list below would be changed for the following years depending on the user experiences and market needs. However, these are the best candidates so far.

BlueHost
BlueHost

Whether you're looking to create a website, blog or online store, Bluehost can get you started with a hosting plan tailored to your specific needs.

Visit Website
SiteGround
SiteGround

SiteGround web hosting is trusted by more than 2,000,000 domains for its top speed, unmatched security, 24/7 fast, and expert support!

Visit Website
Total
0
Shares
0
0
0
0
0
0
0
Kent Wynn

I'm Kent Wynn, from Vietnam, currently working as a Software Engineer, UI/UX Designs & Frontend Architect. With years of working and project experiences, I decided to develop KentWynn.Com, a technical article-based website for sharing and learning.

Previous Article
4 Solutions To Fix WordPress 503 Service Unavailable Error
  • WordPress

4 Solutions To Fix WordPress 503 Service Unavailable Error

  • August 16, 2021
View Post
Next Article
how-to-create-a-blog-a-guide-to-complete-blogging-success
  • Search Engine Optimization (SEO)
  • WordPress

How to Create a Blog | A Guide to Complete Blogging Success

  • August 28, 2021
View Post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • What is HTML6? HTML6’s New Structural Patterns
  • How to safely upload SVG files to WordPress
  • How to Create a Blog | A Guide to Complete Blogging Success
  • Top 20 Best Free Website Speed Test Tools
  • How To Debug WordPress: A Complete Beginner’s Guide
Subscribe To Us

Get New Posts Delivered To Your Inbox

Stay Updated!

Subscribe now to our newsletter to receive latest articles, frontend trends and more!

Connect Me

I’m truly myself.

For me, success means the people we know and together what we are working on. I believe in teamwork and hard work, not magic!
About Me
Quick Navigation
  • Frontend Lang
    • HTML +
    • CSS SCSS LESS +
    • JavaScript ES6 TS
    • RxJS Library
    • Angular Framework
    • Ionic Framework
    • JavaFX Framework
    • Java Spring Framework
  • Frontend Dev
  • WordPress
  • UI/UX Designs
  • SEO
  • Tech Follows
Our Services
  • Become Frontend Master Courses
  • Marketing Services$150
  • Website Services$200
Shop Connect
  • Kent Wynn’s Shop$10
    • Wordpress Themes/Plugins
    • UI/UX Software
    • macOS Software
    • eBooks
    • Others
  • My Account
  • Cart
  • Checkout
Kent Wynn Kent Wynn
  • Contact Me
  • Hire Me
  • Donate Me
© 2021 Kent Wynn - Software Engineer | UI/UX & Frontend Architect | All Rights Reserved.

Input your search keywords and press Enter.