{"id":18138,"date":"2019-05-24T13:54:23","date_gmt":"2019-05-24T13:54:23","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=18138"},"modified":"2026-03-10T10:07:16","modified_gmt":"2026-03-10T10:07:16","slug":"wordpress-debug","status":"publish","type":"post","link":"\/my\/tutorials\/debug-wordpress","title":{"rendered":"WordPress debug: What is it, how to enable it, and best practices"},"content":{"rendered":"<p>The WordPress debug mode is a built-in feature that lets you display and log error messages for more accurate troubleshooting. It is crucial for maintaining your website functionality, especially after adding custom code that might be triggering issues.<\/p><p>This tutorial will explain the WordPress debug mode and different ways to enable it. Since these methods suit different troubleshooting tasks, choose one based on your needs.&nbsp;<\/p><p>\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What is WordPress debug?<\/h2>\n                    <p> WordPress debug is a built-in feature that lets developers print and list error messages for troubleshooting. You can enable it by activating different PHP global variables like the <strong>WP_DEBUG<\/strong> and <strong>SCRIPT_DEBUG<\/strong>. Alternatively, you can debug WordPress by showing important data like script execution using a plugin.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-enable-wordpress-debug-with-code\">How to enable WordPress debug with code<\/h2><p>In this section, we will explain how to enable the WordPress debug mode using four different PHP variables based on your troubleshooting needs.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-enable-wp-debug\">1. Enable WP_DEBUG<\/h3><p>Activating <strong>WP_DEBUG <\/strong>is the most basic way to enable debugging in WordPress. It can check for PHP code issues in different website components, including themes and plugins.<\/p><p>To use the WP_DEBUG global variable, simply change its value in the <a href=\"\/my\/tutorials\/wp-config-php\">wp-config.php file<\/a> from <strong>FALSE<\/strong> to <strong>TRUE<\/strong>. Before doing so, ensure you can access your WordPress root folder using a file transfer protocol (FTP) application like <a href=\"\/my\/tutorials\/ftp\/filezilla-ftp-configuration\">FileZilla<\/a> or your hosting provider&rsquo;s file manager.<\/p><p>If you use an FTP client, you&rsquo;ll have to download the PHP file, edit it on your computer, and re-upload it to your website.<\/p><p>To simplify the process, we will use <a href=\"\/my\/tutorials\/how-to-use-hostinger-file-manager\/\">Hostinger File Manager<\/a>, which lets you edit <strong>wp-config.php<\/strong> directly in your web browser. Here are the steps:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <strong>hPanel.<\/strong> Navigate to<strong> Websites<\/strong> &rarr; <strong>Dashboard<\/strong> &rarr;<strong> File Manager<\/strong>.&nbsp;<\/li>\n\n\n\n<li>Go to your WordPress <strong>public_html <\/strong>root folder.<\/li>\n\n\n\n<li>Open the <strong>wp-config.php<\/strong> file by double-clicking it.&nbsp;<\/li>\n\n\n\n<li>Find the following line. If you can&rsquo;t locate this entry, manually add it after the <strong>$table_prefix = &lsquo;wp_&rsquo;;<\/strong> line:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_DEBUG', false );&nbsp;<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Change the value from false to <strong>TRUE<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed49af9\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"518\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/image2-1024x518.png\" alt=\"WP_DEBUG line placed in the wp-config.php file\" class=\"wp-image-115605\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2-1024x518.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2-300x152.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2-150x76.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2-768x388.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2-1536x777.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/image2.png 1999w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"6\" class=\"wp-block-list\">\n<li>Click the <strong>disk<\/strong> icon on the top right corner of the editor to save the changes.&nbsp;<\/li>\n<\/ol><p>That&rsquo;s it! If you encounter PHP issues, WordPress will print the error message on the front end.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed4d5bd\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"290\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/php-error-message-on-wordpress-front-end-1024x290.png\" alt=\"PHP error message on WordPress front end\" class=\"wp-image-115606\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/php-error-message-on-wordpress-front-end-1024x290.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/php-error-message-on-wordpress-front-end-300x85.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/php-error-message-on-wordpress-front-end-150x42.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/php-error-message-on-wordpress-front-end-768x217.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/php-error-message-on-wordpress-front-end.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>WordPress provides additional PHP variables for modifying the debug mode. For example, <strong>WP_DEBUG_DISPLAY<\/strong> hides the error messages on the front end when set to <strong>FALSE<\/strong> to preserve the user experience.<\/p><p>Developers typically use it with <strong>WP_DEBUG_LOG<\/strong>, which lists the PHP issues in the <strong>debug.log <\/strong>file inside the <strong>wp-content<\/strong> directory. Like WP_DEBUG, you add these variables to <strong>wp-config.php<\/strong> above the &ldquo;<strong>That&rsquo;s all, stop editing!<\/strong>&rdquo; line. Your configuration should look like the following code:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if ( ! defined( 'WP_DEBUG' ) ) {\n\n&nbsp;&nbsp;&nbsp;define( 'WP_DEBUG', true );\n\n&nbsp;&nbsp;&nbsp;define('WP_DEBUG_DISPLAY', false);\n\n&nbsp;&nbsp;&nbsp;define('WP_DEBUG_LOG', true);\n\n}<\/pre><p>Remember that WordPress will log messages that occur after you activate the <strong>WP_DEBUG_LOG<\/strong> variable. If you want to document previous issues, you must manually replicate them.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed526c0\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"302\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/wordpress-debug-log-entries-1024x302.png\" alt=\"WordPress debug log entries\" class=\"wp-image-115607\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-debug-log-entries-1024x302.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-debug-log-entries-300x89.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-debug-log-entries-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-debug-log-entries-768x227.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-debug-log-entries.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><div><p class=\"important\"><strong>Important!<\/strong> If you want to disable the WordPress debug mode, remember to set <strong>WP_DEBUG_DISPLAY<\/strong> and <strong>WP_DEBUG_LOG<\/strong> to <strong>FALSE<\/strong> to prevent these features from running indefinitely and wasting resources.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-2-enable-script-debug\">2. Enable SCRIPT_DEBUG<\/h3><p>By default, WordPress runs minified JavaScript (JS) and CSS core files that hide non-essential features like error messages. While this behavior helps improve load time, it can make troubleshooting trickier since you can&rsquo;t see the detailed information.<\/p><p>To debug core JS and CSS files, enable the dev versions using the<strong> SCRIPT_DEBUG<\/strong> variable. Doing so is especially useful after modifying your website&rsquo;s appearance using these programming languages.<\/p><p>The steps to enable SCRIPT_DEBUG are similar to those for WP_DEBUG. Here&rsquo;s how to do so using Hostinger File Manager:<\/p><ol class=\"wp-block-list\">\n<li>Open your WordPress <strong>public_html <\/strong>root folder.<\/li>\n\n\n\n<li>Double-click the <strong>wp-config.php<\/strong> file to open it.&nbsp;<\/li>\n\n\n\n<li>Find the following line and change the value from <strong>FALSE<\/strong> to <strong>TRUE<\/strong>. If you can&rsquo;t find one, add it before the &ldquo;<strong>That&rsquo;s all stop editing<\/strong>&rdquo; line.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'SCRIPT_DEBUG', true );<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Click the <strong>disk<\/strong> icon on the top right to save the changes.&nbsp;<\/li>\n<\/ol><p>Now, if your website encounters core CSS or JavaScript-related issues, it should print error messages. After troubleshooting, remember to disable the variable and reactivate the minified core files to avoid performance issues.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-enable-php-error-log\">3. Enable PHP error log<\/h3><p>PHP has the built-in <strong>error_log() <\/strong>function that lets you log issues related to the scripting language. This feature runs on the server level, meaning it can debug all PHP applications in your hosting environment, including WordPress and its database.<\/p><p>You can enable the PHP logging by editing the <a href=\"\/my\/tutorials\/what-is-php-ini\/\">php.ini<\/a> file. However, several web hosting providers disable this feature due to design and security concerns.<\/p><p>If you use <a href=\"\/my\/wordpress-hosting\">Hostinger managed WordPress plans<\/a>, you can enable this feature via hPanel. Here&rsquo;s how to do so:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <strong>hPanel<\/strong> and head to <strong>Websites <\/strong>&rarr; <strong>Dashboard<\/strong> &rarr; <strong>sidebar<\/strong> &rarr; <strong>Advanced<\/strong> &rarr; <strong>PHP Configuration<\/strong>.<\/li>\n\n\n\n<li>Select the <strong>PHP options<\/strong> tab.&nbsp;<\/li>\n\n\n\n<li>Check the <strong>logErrors<\/strong> box to enable logging. If you want to display the error message on the front end, enable the <strong>displayErrors<\/strong> option. We recommend leaving it unchecked.&nbsp;<\/li>\n\n\n\n<li>Scroll down and hit <strong>Save<\/strong>.&nbsp;<\/li>\n<\/ol><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>You can access the log file by opening the <strong>.log<\/strong> directory within your server&rsquo;s root folder. Here&rsquo;s how to do so on Hostinger File Manager:<\/p><ol class=\"wp-block-list\">\n<li>On your <strong>hPanel <\/strong>dashboard, navigate to the <strong>sidebar<\/strong> &rarr;<strong> Files <\/strong>&rarr; <strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Click the <strong>Access all files of hosting<\/strong> button.<\/li>\n\n\n\n<li>Open the <strong>.log<\/strong> folder. If you can&rsquo;t find this directory, it might be hidden. To show it, go to the <strong>sidebar<\/strong> &rarr; <strong>Settings <\/strong>and uncheck the <strong>Hide dotfiles<\/strong> box.<\/li>\n\n\n\n<li>Double-click the <strong>error_log_domain_tld<\/strong> file to see all PHP errors on your website, including their timestamps and types.&nbsp;<\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-4-enable-wpdb-error-reporting\">4. Enable WPDB error reporting<\/h3><p>To debug your WordPress database, enable <strong>wpdb<\/strong> class&rsquo; <strong>show_errors<\/strong> variable. This setting will print SQL errors on your website, which helps troubleshoot database connection and syntax errors.<\/p><p>Here&rsquo;s how to enable the <strong>WPDB<\/strong> error reporting via Hostinger File Manager:<\/p><ol class=\"wp-block-list\">\n<li>Open your WordPress website&rsquo;s <strong>public_html<\/strong> folder &rarr;<strong> wp-includes<\/strong>.<\/li>\n\n\n\n<li>Double-click the <strong>class-wpdb.php<\/strong> file to open it.&nbsp;<\/li>\n\n\n\n<li>Find the <strong>class wpdb <\/strong>line.<\/li>\n\n\n\n<li>Within its brackets, find the<strong> $show_errors<\/strong> variable and change its value to<strong> TRUE<\/strong> like so:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public $show_errors = true;&nbsp;<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Click the <strong>disk<\/strong> icon to save the changes.&nbsp;<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-how-to-enable-wordpress-debug-using-a-plugin\">How to enable WordPress debug using a plugin<\/h2><p>If you&rsquo;re not comfortable working with code, you can enable the WordPress debug mode using a plugin. For example, <a href=\"https:\/\/wordpress.org\/plugins\/wp-debugging\/\" target=\"_blank\" rel=\"noopener\">WP Debugging<\/a> lets you change the value of the WP_DEBUG variable directly from your admin dashboard.<\/p><p>After you <a href=\"\/my\/tutorials\/wordpress\/how-to-install-wordpress-plugins\">download and install the plugin<\/a> via the WordPress admin dashboard, follow these steps to enable the debugging mode:<\/p><ol class=\"wp-block-list\">\n<li>Go to the <strong>sidebar<\/strong> &rarr;<strong> Tools<\/strong> &rarr; <strong>WP Debugging<\/strong>.<\/li>\n\n\n\n<li>Check the <strong>Set WP_DEBUG to true <\/strong>box. Optionally, you can set whether you want WordPress to show the issues on the front end and ignore fatal errors.&nbsp;<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed59234\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"547\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area-1024x547.png\" alt=\"WP Debugging settings in the WordPress admin area\" class=\"wp-image-115608\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area-1024x547.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area-300x160.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area-150x80.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area-768x410.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wp-debugging-settings-in-the-wordpress-admin-area.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Save Changes<\/strong>.<\/li>\n<\/ol><p>For a more comprehensive analysis than the default WordPress debugging feature, we recommend <a href=\"https:\/\/wordpress.org\/plugins\/query-monitor\/\" target=\"_blank\" rel=\"noopener\">Query Monitor<\/a>. It shows includes data for troubleshooting database queries, PHP calls, and script executions.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed5d731\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"502\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard-1024x502.png\" alt=\"Query Monitor plugin user interface in the WordPress admin dashboard\" class=\"wp-image-115609\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard-1024x502.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard-300x147.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard-150x74.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard-768x377.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/query-monitor-plugin-user-interface-in-the-wordpress-admin-dashboard.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After you install the plugin, a menu will appear on your admin bar. Clicking it opens a window that details various data categories, such as:<\/p><ul class=\"wp-block-list\">\n<li><strong>Overview<\/strong> &ndash; shows a summary of your WordPress website loading process, including the number of queries, memory usage, and page generation time.&nbsp;<\/li>\n\n\n\n<li><strong>Database Queries<\/strong> &ndash; lists all the calls WordPress sends to the database when loading a web page, which is useful for checking SQL syntax errors or connectivity issues.<\/li>\n\n\n\n<li><strong>Logs <\/strong>&ndash; contains any error messages from PHP components of your WordPress website that have the <strong>qm\/debug<\/strong> action, like plugins.<\/li>\n\n\n\n<li><strong>Scripts<\/strong> &ndash; displays all JavaScript files that WordPress loads when rendering a web page, including their position, source, and host.&nbsp;<\/li>\n\n\n\n<li><strong>Styles<\/strong> &ndash; contains a list of CSS files WordPress uses to render a web page content, including their handler and position.&nbsp;<\/li>\n<\/ul><p>Several Query Monitor features, like logging, won&rsquo;t work out of the box, and you must add the tracking code manually. The plugin provides a manual in each section to guide you through the setup.<\/p><p>Note that all logged-in users can see the plugin&rsquo;s menu, potentially exposing sensitive information. To hide the debugging information, <a href=\"\/my\/tutorials\/wordpress-hide-admin-bar\">hide the WordPress admin bar<\/a> for all accounts except administrators.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Need help troubleshooting your website?<\/h4>\n                    <p> Hostinger WordPress hosting&rsquo;s <a href=\"\/blog\/wordpress-ai-troubleshooter\">AI Troubleshooter<\/a> automatically warns you of any issues on your website. You can easily fix them by clicking the <strong>Fix errors<\/strong> button in hPanel.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-debug-best-practices\">WordPress debug best practices<\/h2><p>These are best practices for an effective and secure troubleshooting process when debugging WordPress.<\/p><p><strong>Avoid showing error messages<\/strong><\/p><p>While error messages help you identify issues, displaying them on the front end might harm user experience.<\/p><p>A default error page also makes your website look less trustworthy. To avoid it, set up a redirect to another page so visitors can continue to navigate your site.<\/p><p>Moreover, some error messages might display parts of your WordPress website code. This might raise a security risk since cyber criminals can use this information to find potential entry points.<\/p><p><strong>Enable the maintenance mode<\/strong><\/p><p>When debugging or troubleshooting issues, it&rsquo;s best to enable <a href=\"\/my\/tutorials\/wordpress-maintenance-mode\">WordPress maintenance mode<\/a>. This hides any error messages and redirects visitors to a specific landing page.<\/p><p>Hostinger users can easily enable the maintenance mode from hPanel. Go to <strong>Websites<\/strong> &rarr; <strong>Dashboard<\/strong> &rarr;<strong> WordPress<\/strong> &rarr;<strong> Overview<\/strong>. Then, click on the <strong>Maintenance mode <\/strong>toggle.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed61c3f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"306\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel-1024x306.png\" alt=\"WordPress maintenance mode toggle in hPanel\" class=\"wp-image-115610\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel-1024x306.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel-300x90.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel-150x45.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel-768x229.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-maintenance-mode-toggle-in-hpanel.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Note that this feature redirects users to the Hostinger&rsquo;s default Maintenance page. If you want a custom design, use a plugin like <a href=\"https:\/\/wordpress.org\/plugins\/wp-maintenance-mode\/\" target=\"_blank\" rel=\"noopener\">LightStart<\/a>.<\/p><p><strong>Use WordPress staging area<\/strong><\/p><p>After debugging an error, we recommend testing the solution in a staging environment first before deploying it to the live site.<\/p><p>Hostinger users with the Business or higher plan can easily set up a WordPress staging environment by heading to<strong> hPanel <\/strong>&rarr; <strong>Websites <\/strong>&rarr; <strong>Dashboard<\/strong> &rarr; <strong>WordPress<\/strong> &rarr;<strong> Staging <\/strong>and clicking the <strong>Create staging <\/strong>button<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69df8fed65768\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"366\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/wordpress-staging-creation-menu-in-hpanel-1024x366.png\" alt=\"WordPress staging creation menu in hPanel\" class=\"wp-image-115611\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-staging-creation-menu-in-hpanel-1024x366.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-staging-creation-menu-in-hpanel-300x107.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-staging-creation-menu-in-hpanel-150x54.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-staging-creation-menu-in-hpanel-768x275.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/09\/wordpress-staging-creation-menu-in-hpanel.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Alternatively, you can also set up a staging site using a plugin like <a href=\"https:\/\/wordpress.org\/plugins\/wp-staging\/\" target=\"_blank\" rel=\"noopener\">WP Staging<\/a><strong> <\/strong>or <a href=\"\/my\/tutorials\/install-wordpress-locally\">install a WordPress environment locally<\/a> on your personal computer using a web stack such as <strong>XAMPP<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>The WordPress debug mode lets developers display and log error messages for easier troubleshooting. To enable it, access your website&rsquo;s root directory and open the <strong>wp-config.php<\/strong> file. Set the <strong>WP_DEBUG<\/strong> and <strong>WP_DEBUG_LOG<\/strong> variables to <strong>TRUE<\/strong>.<\/p><p>To display CSS and JavaScript core file errors, enable the dev version of these programming languages. To do so, open the <strong>wp-config.php<\/strong> file and set the<strong> SCRIPT_DEBUG<\/strong> parameter to <strong>TRUE<\/strong>.<\/p><p>You can also enable PHP&rsquo;s built-in error logging feature by enabling the <strong>log_error()<\/strong> function in the <strong>php.ini<\/strong> file. Alternatively, Hostinger users can easily do so by activating the <strong>logErrors<\/strong> feature in hPanel&rsquo;s <strong>PHP Configuration<\/strong> menu.<\/p><p>To check database issues, set the <strong>$show_errors<\/strong> variable in <strong>public_html\/wp-includes\/class-wpdb.php<\/strong> to <strong>TRUE<\/strong>. If you&rsquo;re uncomfortable editing code, you can enable WP_DEBUG using the <strong>WP Debugging<\/strong> plugin or check the data directly using <strong>Query Monitor<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-debug-faq\">WordPress Debug FAQ<\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1726157541698\"><h3 class=\"schema-faq-question\">How do I check my WordPress debug mode?<\/h3> <p class=\"schema-faq-answer\">To see if your WordPress debug mode is enabled, open your website&rsquo;s <strong>public_html <\/strong>folder using an FTP client or your hosting provider&rsquo;s file manager. Open <strong>wp-config.php<\/strong> and check if the <strong>define( &lsquo;WP_DEBUG&rsquo;, true) <\/strong>value is set to <strong>TRUE<\/strong>. <strong>FALSE<\/strong> means the debugging is disabled.&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1726157548341\"><h3 class=\"schema-faq-question\">How do I see all the errors in WordPress?<\/h3> <p class=\"schema-faq-answer\">To list all WordPress errors, set the <strong>WP_DEBUG_LOG<\/strong> and <strong>WP_DEBUG<\/strong> variables in <strong>wp-config.php<\/strong> to <strong>TRUE<\/strong>. Alternatively, you can enable the <strong>error_log() <\/strong>function in <strong>php.ini<\/strong>. Hostinger users can do so without coding by activating the<strong> logErrors<\/strong> setting in hPanel&rsquo;s <strong>PHP Configuration<\/strong> menu.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1726157553025\"><h3 class=\"schema-faq-question\">Why is the WordPress debug log not created?<\/h3> <p class=\"schema-faq-answer\">If WordPress doesn&rsquo;t log errors, the <strong>WP_DEBUG_LOG<\/strong> variable is most likely set to <strong>FALSE<\/strong>. In addition, you must set the <strong>WP_DEBUG<\/strong> to <strong>TRUE<\/strong> and <strong>WP_DEBUG_DISPLAY<\/strong> to <strong>FALSE<\/strong>. If you use PHP&rsquo;s <strong>error_log() <\/strong>function, the error log file should be located under the hidden <strong>.log<\/strong> folder.&nbsp;<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>The WordPress debug mode is a built-in feature that lets you display and log error messages for more accurate troubleshooting. It is crucial for maintaining your website functionality, especially after adding custom code that might be triggering issues. This tutorial will explain the WordPress debug mode and different ways to enable it. Since these methods [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/debug-wordpress\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to enable WordPress debug + troubleshooting","rank_math_description":"Learn what wordpress debug is and 4 ways to enable it: 1. Using WP_DEBUG. 2. Using SCRIPT_DEBUG, 3. Using PHP error log and more.","rank_math_focus_keyword":"wordpress debug","footnotes":""},"categories":[1],"tags":[],"class_list":["post-18138","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"hreflangs":[],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/18138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=18138"}],"version-history":[{"count":31,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/18138\/revisions"}],"predecessor-version":[{"id":123117,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/18138\/revisions\/123117"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=18138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=18138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=18138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}