How to enable debug mode for wordpress websites to troubleshoot errors

Today the media image editing function in my wordpress site suddenly had the problem of not being able to save the edited image, checking the console, and finding that the admin-ajax.php page reported a 500 error. To be safe, wordpress will disable the debug function by default, but there is no specific error description, the subsequent debug can not be carried out at all.

To find the exact reason for the error, I logged into the server

Open wp-config.php in the wordpress root directory.
locate

define('WP_DEBUG', false).

modify to

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
a

Enable debug mode in wordpress, the second sentence means that by enabling WP_DEBUG_LOG, users can save all errors in the debug.log file

The debug.log file is in the /wp-content/ folder

On the frontend media page, re-edit the image and save it

Then look at the contents of the debug.log file

wordpressdebug scaled e1747232149910

Here you can see that it is the aliyun-oss plugin incompatibility with the new version of wordpress that is causing the problem

Uninstalled the plugin, problem solved

aliyunoss scaled e1747232174509

Finally, don't forget to turn off debug mode

Leave a Comment

en_USEnglish