The Complete Guide to WordPress Debug Mode: A Quick Way to Pinpoint Site Failures

on maintenance WordPress When working on a website, whether it's installing a new plugin, switching themes or modifying code, you often run into a variety of unexpected problems. Debugging mode (Debug Mode) is a powerful tool to help developers and webmasters troubleshoot problems. It records and displays detailed error information, which helps to quickly identify the root cause of the problem and saves a lot of troubleshooting time.

图片[1]-WordPress 调试模式开启指南:快速排查插件与主题问题

This article will introduce the role of debug mode and provide two practical ways to turn it on for different usage scenarios.

The significance of turning on debug mode

The debug mode can record PHP Error reporting, warning and notification messages. Turning on debug mode often provides a useful clue when a site is

  • White screen or abnormal functioning of the page after installing or updating the plugin/theme
  • Certain functions are not working, but there is no visible error message.
  • Everything is fine on the frontend of the site, but the backend crashes frequently
  • Need to identify hidden errors in the code execution logic

Debug logs can be used not only to fix current problems, but also to prevent potential risks.

Method 1: Use WP Debugging plugin to enable debugging mode

If you are not familiar with the code or FTP operation, it is recommended to use the plugin to quickly complete the debug mode open.

The procedure is as follows:

  • log in WordPress Backend, click Plugins > Install Plugins
  • Type in the search field WP Debugging
  • Click "mounting", followed by clicking on "start using"
图片[2]-WordPress 调试模式开启指南:快速排查插件与主题问题
  • go into Tools > WP Debugging
  • Check the box "Set WP_DEBUG to true" and save the settings
图片[3]-WordPress 调试模式开启指南:快速排查插件与主题问题

At this point, debug mode is enabled. After completing the debugging task, please disable this feature so that the error message is not exposed to the foreground.

Method 2: Manual modification wp-config.php file

When the backend of the site is not accessible, or if you prefer to do it manually, you can modify the wp-config.php file to enable debug mode.

The steps are as follows:

  • utilization FTP tool (such as FileZilla) to connect to the server
  • Find the root directory of your website (usually public_html) in the wp-config.php file
  • Download the file locally and open it with a text editor (e.g. Notepad++, Sublime Text)
  • Find the following line of code:
/* That's all, stop editing! Happy publishing. */
  • Add the following above the line:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ).
  • Save changes and upload the file to overwrite the original

Upon completion.WordPress will be in wp-content folder automatically generates a debug.log Log file for all error messages.

Methods to turn off debug mode:

Repeat the above steps to change the code to:define( 'WP_DEBUG', false );

Or just delete the relevant code.

Methods for viewing debug logs

When debug mode is enabled, you can view the error log as follows:

  • When using the plug-in: In the backend top menu click on "Debug Quick Look", and then select "View File", will display the debug log content in a new tab
图片[4]-WordPress 调试模式开启指南:快速排查插件与主题问题
  • In manual mode: Login FTPEnter wp-content folder, find the debug.log file, open it with a text tool to view

Recommendations for use

  • Turning on debug mode is recommended to operate in a test site or development environment
  • Backup before modifying any file to avoid unrecoverable
  • Debugging should be turned off in a timely manner after the problem has been troubleshooted

summarize

The debugging mode is WordPress An important diagnostic tool in the system. Whether you are a novice webmaster or a developer, you can use it to quickly locate the problem when you encounter plugin conflicts, code errors or page anomalies. Through the plug-in or manual two ways, you can choose flexibly according to their own needs.

Related articles


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:托尼屎大颗
THE END
If you like it, support it.
kudos363 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments