{"id":18391,"date":"2026-09-29T23:17:28","date_gmt":"2026-09-29T20:17:28","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/debug-wordpress-wp-toolkit\/"},"modified":"2026-11-22T20:39:04","modified_gmt":"2026-11-22T17:39:04","password":"","slug":"debug-wordpress-wp-toolkit","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/debug-wordpress-wp-toolkit\/","title":{"rendered":"Debugging WordPress: Turning On WP_DEBUG and debug.log from WP Toolkit or wp-config.php, Maintenance Mode, and Reading the Error"},"content":{"rendered":"<div class=\"hkb\" dir=\"ltr\">\n<div class=\"hkb-tldr\"><b>In short<\/b>Turn on debugging with errors saved to a file and <b>not shown to visitors<\/b>: in WP Toolkit switch on <b>Debugging<\/b> with <code>WP_DEBUG_LOG<\/code>, or add the lines to <code>wp-config.php<\/code> by hand. Reproduce the problem, then open <code>wp-content\/debug.log<\/code> and read the last error: its path tells you which plugin or theme is at fault. Turn debugging off when you are done.<\/div>\n<div class=\"hy-vid\"><div style=\"width: 1280px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-18391-1\" width=\"1280\" height=\"720\" poster=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-wp-debug-en.jpg\" preload=\"none\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-wp-debug-en.mp4?_=1\" \/><a href=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-wp-debug-en.mp4\">https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-wp-debug-en.mp4<\/a><\/video><\/div><\/div>\n<p>\u201cThere has been a critical error\u201d tells you nothing. Behind it is a real PHP error with a line and a path, and debug mode is how you see it. The idea: make WordPress write its errors to a file you read, not on the page in front of visitors.<\/p>\n<h2>The debug constants<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Constant<\/th>\n<th>What it does<\/th>\n<th>Suggested value while debugging<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>WP_DEBUG<\/code><\/td>\n<td>Turns debug mode on<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><code>WP_DEBUG_LOG<\/code><\/td>\n<td>Writes errors to <code>wp-content\/debug.log<\/code><\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><code>WP_DEBUG_DISPLAY<\/code><\/td>\n<td>Shows errors on pages<\/td>\n<td>false on a live site<\/td>\n<\/tr>\n<tr>\n<td><code>SCRIPT_DEBUG<\/code><\/td>\n<td>Uses unminified CSS and JavaScript<\/td>\n<td>Developers only<\/td>\n<\/tr>\n<tr>\n<td><code>SAVEQUERIES<\/code><\/td>\n<td>Stores database queries for analysis<\/td>\n<td>Developers only; slows the site<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>Method 1: WP Toolkit<\/h2>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-wp-c-tools-en.webp\" alt=\"WordPress Management in cPanel\" width=\"800\" height=\"451\" loading=\"lazy\" \/><\/figure>\n<ol class=\"hkb-steps\">\n<li><b>Open WordPress Management<\/b> then your site\u2019s card.<\/li>\n<li><b>Debugging<\/b> switch it on, then open its settings from the link beside it.<\/li>\n<li><b>Choose options<\/b> turn on WP_DEBUG and WP_DEBUG_LOG, and turn off WP_DEBUG_DISPLAY.<\/li>\n<li><b>Save<\/b> then repeat whatever causes the problem on your site.<\/li>\n<\/ol>\n<h2>Method 2: By hand in wp-config.php<\/h2>\n<p>Open <code>wp-config.php<\/code> in <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/how-to-use-file-manager-in-cpanel\/\">File Manager<\/a>. Find the line <code>define( 'WP_DEBUG', false );<\/code> and replace it with these lines, above the line that says <code>That's all, stop editing<\/code>:<\/p>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-wp-t-debug.webp\" alt=\"WP_DEBUG and WP_DEBUG_LOG lines in wp-config.php and a command to read debug.log\" width=\"1100\" height=\"620\" loading=\"lazy\" \/><\/figure>\n<div class=\"hkb-note warn\"><b>A common mistake:<\/b> Defining WP_DEBUG twice in the file. You get a new warning, and WordPress may not use the value you wrote. Edit the existing line rather than adding a second one.<\/div>\n<h2>Reading debug.log<\/h2>\n<p>Open <code>wp-content\/debug.log<\/code> and go to the end. The key line looks like: <code>PHP Fatal error: ... in \/home\/user\/public_html\/wp-content\/plugins\/plugin-name\/file.php on line 120<\/code>.<\/p>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>If the path shows<\/th>\n<th>The cause<\/th>\n<th>Next step<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>wp-content\/plugins\/name<\/code><\/td>\n<td>A plugin<\/td>\n<td>Disable it: <a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/disable-wordpress-plugins-cpanel\/\">disabling plugins<\/a><\/td>\n<\/tr>\n<tr>\n<td><code>wp-content\/themes\/name<\/code><\/td>\n<td>The theme<\/td>\n<td>Switch to a default theme briefly and contact the theme developer<\/td>\n<\/tr>\n<tr>\n<td><code>Allowed memory size<\/code><\/td>\n<td>Out of memory<\/td>\n<td><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/fix-wordpress-memory-exhausted-error\/\">the memory error guide<\/a><\/td>\n<\/tr>\n<tr>\n<td><code>syntax error<\/code><\/td>\n<td>A typo in code you edited<\/td>\n<td><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/fix-syntax-error-wordpress\/\">the syntax error guide<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><b>Notice<\/b> and <b>Deprecated<\/b> lines are hints for developers and do not usually break the site. Focus on <b>Fatal error<\/b>.<\/p>\n<h2>Maintenance mode while you fix it<\/h2>\n<p>On the site card in WP Toolkit switch on <b>Maintenance mode<\/b>, so visitors see an \u201cunder maintenance\u201d page while you work. Switch it off when you are done.<\/p>\n<h2>After the fix<\/h2>\n<ul class=\"hkb-list\">\n<li>Turn WP_DEBUG off, or set the lines back to false.<\/li>\n<li>Delete or empty <code>debug.log<\/code>; it can hold paths and details that should not stay around.<\/li>\n<li>If you cannot find the cause, send the last 20 lines of the file in <a href=\"https:\/\/hyyatdomain.com\/submitticket.php\" target=\"_blank\" rel=\"noopener\">a support ticket<\/a>.<\/li>\n<\/ul>\n<h2>Other places errors show up<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Source<\/th>\n<th>Where<\/th>\n<th>When it helps<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Recovery Mode email<\/td>\n<td>The admin email address<\/td>\n<td>On a fatal error WordPress names the plugin or theme at fault and sends a safe login link<\/td>\n<\/tr>\n<tr>\n<td>Site Health<\/td>\n<td>Tools \u203a Site Health<\/td>\n<td>Configuration problems: PHP version, updates, scheduled tasks<\/td>\n<\/tr>\n<tr>\n<td>Server error log<\/td>\n<td>cPanel \u203a Errors<\/td>\n<td>Apache and PHP errors that happen before WordPress runs<\/td>\n<\/tr>\n<tr>\n<td>error_log file<\/td>\n<td>Sometimes in the site folder itself<\/td>\n<td>PHP errors when WP_DEBUG_LOG is not on<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>A full example from start to finish<\/h2>\n<ol class=\"hkb-steps\">\n<li><b>The symptom<\/b> after updating plugins, the site showed \u201cThere has been a critical error\u201d.<\/li>\n<li><b>Turning it on<\/b> in WP Toolkit: Debugging with WP_DEBUG_LOG, display off.<\/li>\n<li><b>Reproducing<\/b> we loaded the home page once.<\/li>\n<li><b>Reading<\/b> the last line of debug.log: a Fatal error in a file under <code>wp-content\/plugins\/<\/code> belonging to one of the updated plugins.<\/li>\n<li><b>Fixing<\/b> we deactivated that plugin and the site came back, then restored its previous version from the WP Toolkit backup until a fixed update is released.<\/li>\n<li><b>Cleaning up<\/b> we turned debugging off and deleted debug.log.<\/li>\n<\/ol>\n<h2>Errors you will read often, in plain words<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Message<\/th>\n<th>What it means<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Call to undefined function<\/code><\/td>\n<td>Code calls a function that does not exist: often a plugin needing another plugin that is off, or an unsuitable PHP version<\/td>\n<\/tr>\n<tr>\n<td><code>Cannot redeclare<\/code><\/td>\n<td>The same function is defined twice: often two copies of one plugin<\/td>\n<\/tr>\n<tr>\n<td><code>Maximum execution time exceeded<\/code><\/td>\n<td>A task took longer than allowed, such as a big import<\/td>\n<\/tr>\n<tr>\n<td><code>headers already sent<\/code><\/td>\n<td>A space or blank line before <code>&lt;?php<\/code> or after the end of a file you edited<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"hkb-note\">Looking for hosting built for WordPress? See <a href=\"https:\/\/www.hyyat.com\/en\/wordpress-hosting\/\">Hyyat Host WordPress hosting<\/a>.<\/div>\n<h2>Our customers asked<\/h2>\n<div class=\"hkb-faq\">\n<details>\n<summary>debug.log was not created<\/summary>\n<p>Make sure WP_DEBUG and WP_DEBUG_LOG are both true and that you repeated the problem after turning them on. wp-content also needs to be writable.<\/p>\n<\/details>\n<details>\n<summary>Should I leave debugging on?<\/summary>\n<p>No. The file grows fast and reveals details about your site. Turn it on only when needed.<\/p>\n<\/details>\n<details>\n<summary>The site is a white page and I cannot reach WP Toolkit<\/summary>\n<p>Edit wp-config.php by hand in File Manager; that always works.<\/p>\n<\/details>\n<details>\n<summary>I found the error but do not understand it<\/summary>\n<p>Copy the whole Fatal error line and send it to the plugin developer, or to us in a ticket.<\/p>\n<\/details>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In shortTurn on debugging with errors saved to a file and not shown to visitors: in WP Toolkit switch on Debugging with WP_DEBUG_LOG, or add the lines to wp-config.php by hand. Reproduce the problem, then open wp-content\/debug.log and read the last error: its path tells you which plugin or theme is at fault. Turn debugging [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":21455,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_templately_pack_id":"","_templately_imported_at":"","_templately_source":"","_templately_import_session_id":"","footnotes":""},"doc_category":[2747],"doc_tag":[],"class_list":["post-18391","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-wordpress-explanations"],"year_month":"2026-11","word_count":818,"total_views":"4","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin","author_nicename":"admin","author_url":"https:\/\/www.hyyat.com\/en\/author\/admin\/"},"doc_category_info":[{"term_name":"WordPress Guides","term_url":"https:\/\/www.hyyat.com\/en\/kb\/wordpress-explanations\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/comments?post=18391"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media\/21455"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=18391"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=18391"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=18391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}