How to start Debug mode in WordPress to find the cause of the error?

When a WordPress website is updating the system core program, background theme or plug-in, the message "This website has a major problem" will occasionally appear, causing the website to fail to operate normally, and sometimes even the backend cannot be logged in. The novice webmasters may find it quite scary. , at this time, you can start the WordPress built-in debug system (Debug Systems) to understand where the problem occurs and solve it.

Basic introduction to Debug mode

Debug Systems is a built-in debugging system for WordPress, which records system errors in the debug.log text file to help webmasters check the problem one by one, usually the incompatibility between the system core program, the theme and the plug-in. , but the debug system, which is disabled by default, must be activated to debug the system.

There is a major problem with this site.Please check your webmaster email inbox for instructions.

Learn more about troubleshooting in WordPress

Debugging mode startup steps

Step XNUMX: Find the wp-config.php configuration file

In the WordPress installation folder/public_html, look for the WordPress core configuration file named "wp-config.php", and find a line of "define('WP_DEBUG', false);" setting, which indicates the default Debug mode is not enabled.

define('WP_DEBUG', false);

Step XNUMX: Modify WP_DEBUG to start state

Modify the configuration settings of wp-config.php, change the original "define('WP_DEBUG', false);" to the official setting value, set the startup debug mode, record the error message and stop displaying the warning screen first.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Step XNUMX: Check the error record of debug.log

In the WordPress installation folder public_html/wp-content, look for the text file named "debug.log", open the text file and check the error messages one by one, usually the theme and plug-in cause PHP execution errors.

[12-Aug-2022 14:01:51 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)

Solution case of Debug mode

The "major problem with this website" occurred this time, mainly due to the change from the traditional editor to the block editor. Often when opening or adding an article, an error screen will appear, which is usually resolved after refreshing the page. , but the same problem often occurs.

After starting the debug mode, when the same problem occurs again, immediately check the contents of the debug.log, and the message "PHP Fatal error: Allowed memory size of 268435456 bytes exhausted" appears. It turned out to be a memory problem when writing an article using the block editor. The problem of insufficiency.

because of usingCloudwaysIt is very convenient to increase the upper limit of the memory required by PHP. The "Setting & Packages" of the advanced server (Servers) is set to the page, and the default value of the "Memory Limit" is 256MB, which seems to be quite sufficient and does not need to be adjusted.

then enterCloudwaysOn the Application Settings screen, check the "PHP FPM SETTINGS" option in the "Application Settings" setting page. The default value is [memory_limit] = 32M. After increasing it to 64M, keep checking whether it is enough.

;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M
;php_admin_value[max_execution_time] = 120
;php_admin_value[date.timezone] = Asia/Taipei

In addition, it is also possible to directly modifyphp.iniProfile, set the memory limit of the entire server, or adjustwp-config.phpConfiguration file to adjust the memory limit for a single website.

// 設定一般網頁的記憶體上限
define( 'WP_MEMORY_LIMIT', '128M' );

// 設定管理後台的記憶體上限
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

If modifiedphp.ini或wp-config.phpIf you cannot change the setting value, you must directly modify the PHP configuration value, find default-constants.php in the /public_html/wp-includes path, and modify the default memory limit.

// Define memory limits.
	if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
			define( 'WP_MEMORY_LIMIT', $current_limit );
		} elseif ( is_multisite() ) {
			define( 'WP_MEMORY_LIMIT', '64M' );
		} else {
			define( 'WP_MEMORY_LIMIT', '40M' );

	if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
			define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
		} elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
			define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
		} else {
			define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Debug plug-in in debug mode

If you are unfamiliar with WordPress system program modification, it is recommended to install it directlyWP DebuggingThe plug-in program can directly enable the debug mode of WordPress. The plug-in also provides the function of viewing the content of "debug.log", which can directly check and solve the problem.

Is this article helpful to you?

If you like the article...

Welcome to track our dynamics!

Sorry the article didn't help you!

please give us suggestions

Follow Us On Instagram

Recommended reading for the latest articles

About Ailvzhi two or three things

Selected Questions and Answers for Online Room Reservation


A letter has been successfully sent to contact Love Travel!
Failed to send the letter, please recheck whether the information in the fields is complete!

best booking platform

Use the online hotel, flight and train booking platform to enjoy guaranteed lowest price, free cancellation, accumulation of points and more.

cheapest price comparison site

Use the HotelsCombined/Skyscanner online comparison platform to instantly search for the lowest prices on hotels, flights, and car rentals.

The most practical trip booking

After completing the reservation, make good use of the kkday/klook online booking platform to create your own exclusive itinerary before your trip.

Attractions tickets
Sightseeing itinerary
Outdoor activity
traffic ticket
Attractions tickets
Package itinerary
local experience
Accommodation project

Most Recommended Website Builder

iTravelBlog website is built using and recommends the following cloud hosting platforms, themes and plug-ins.

Use flexible and user-friendly cloud hosting services
Highly customizable, fast-loading website theme
Powerful, lightweight and fast code management plug-in
Scroll to Top