{"id":5427,"date":"2020-03-12T15:00:35","date_gmt":"2020-03-12T14:00:35","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=5427"},"modified":"2021-10-20T09:03:20","modified_gmt":"2021-10-20T07:03:20","slug":"how-to-turn-on-error-logs-in-wordpress","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/how-to-turn-on-error-logs-in-wordpress\/","title":{"rendered":"How to Turn On Error Logs in WordPress"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]Although WordPress is relatively easy to manage, troubleshooting errors are quite a common issue for its users. Dealing with them usually isn\u2019t difficult &#8211; all it takes is a little bit of practice. The first step of every WordPress error troubleshooting is retrieving the error log. [\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]The error log contains all errors, warnings, and notices about the code behind your site. It can sometimes help you pinpoint the exact file and line of code that are causing the issue. The error log can also provide clues for solving the seemingly insoluble errors, such as \u201c<a href=\"https:\/\/qodeinteractive.com\/magazine\/wordpress-white-screen-of-death\/\">the white screen of death<\/a>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Making sense of the error log, however, can be quite challenging if you are not tech-savvy. To become tech-savvy, you have to start somewhere &#8211; so let\u2019s begin by showing you how to turn on and acquire the error log in WordPress. [\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to Set Up WordPress Error Logs In Your WP-Config File<\/h2>\n<p>[\/vc_column_text][vc_column_text]The <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-edit-wp-config-file\/\">wp-config.php file<\/a> is an important WordPress configuration file. By slightly editing it, you will enable WordPress default debugging and show errors. You can do this via an FTP client or via cPanel.[\/vc_column_text][vc_empty_space height=&#8221;42px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Using an FTP Client<\/h3>\n<p>[\/vc_column_text][vc_column_text]A prerequisite for performing any edits on your server files is to set the file permissions properly. The suggested permissions on the wp-config.php file are 440 or 400. This means you\u2019re only permitted to read the files. To be able to acquire an error log, you need to <a href=\"https:\/\/qodeinteractive.com\/magazine\/set-file-and-folder-permissions-in-wordpress\/\">change the file permissions<\/a> temporarily to 644 or 666. For clarification,644 gives reading and writing\/editing permissions to admin users, while the rest of users get only reading permissions. The 666 value gives both of the aforementioned types of permissions to all users.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To proceed you need an <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-use-ftp\/\">FTP client<\/a> and the knowledge of <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-edit-wp-config-file\/\">editing the wp-config.php file<\/a>. <strong>Start by connecting to the server using your FTP credentials<\/strong>. Navigate to your <strong>root WordPress directory<\/strong>. Locate the <strong>wp-config.php file<\/strong>, right-click on it and select the <strong>\u201cFile permissions\u201d option<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/File-permissions-3.jpg\" class=\"attachment-full size-full\" alt=\"File permissions\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/File-permissions-3.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/File-permissions-3-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/File-permissions-3-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Manually insert one of the suggested numeric values (<strong>644 or 666<\/strong>) and click on \u201c<strong>OK<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-insert-one-of-the-suggested-numeric-values.jpg\" class=\"attachment-full size-full\" alt=\"Manually insert one of the suggested numeric values\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-insert-one-of-the-suggested-numeric-values.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-insert-one-of-the-suggested-numeric-values-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-insert-one-of-the-suggested-numeric-values-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]After changing the permissions, go back to the <strong>root directory<\/strong>, right-click on the <strong>wp-config.php file<\/strong> and select \u201c<strong>View\/Edit<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-edit.jpg\" class=\"attachment-full size-full\" alt=\"WP Config Edit\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-edit.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-edit-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-edit-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>Open the file using a text editor and insert this line of code:<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define('WP_DEBUG', true);<\/pre>\n<p>[\/vc_column_text][vc_column_text]<\/p>\n<p class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">above the \/* That&#8217;s all, stop editing! Happy blogging. *\/.<\/p>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;54px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config.jpg\" class=\"attachment-full size-full\" alt=\"Wp-config\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define('WP_DEBUG', false);\u00a0<\/code> line is already present, only <strong>change false into true<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>Save the changes and upload the edited file to your root WordPress directory<\/strong>. This will override the file that is currently on your server.[\/vc_column_text][vc_empty_space height=&#8221;42px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Via cPanel<\/h3>\n<p>[\/vc_column_text][vc_column_text]You can also use cPanel to edit the wp-config.php file. Log in to the <strong>cPanel<\/strong> using your credentials and click on the \u201c<strong>File Manager<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/02\/File-Manager.jpg\" class=\"attachment-full size-full\" alt=\"File Manager\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/02\/File-Manager.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/02\/File-Manager-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/02\/File-Manager-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Navigate to the <strong>root directory<\/strong> of your WordPress installation on the left, locate the <strong>wp-config.php file<\/strong>, right-click it and select \u201c<strong>Change Permissions<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel.jpg\" class=\"attachment-full size-full\" alt=\"Wp-config permissions in cPanel\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Make sure to <strong>enable both reading and writing permissions<\/strong> for the (admin) user by ticking off the appropriate checkbox. Then, click on \u201c<strong>Change Permissions<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-Change-Permissions.jpg\" class=\"attachment-full size-full\" alt=\"Wp-config permissions in cPanel Change Permissions\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-Change-Permissions.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-Change-Permissions-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Wp-config-permissions-in-cPanel-Change-Permissions-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Afterward, right-click on the <strong>wp-config.php file<\/strong> once more and select \u201c<strong>Edit<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/cPanel-edit-wp-config.jpg\" class=\"attachment-full size-full\" alt=\"cPanel edit wp-config\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/cPanel-edit-wp-config.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/cPanel-edit-wp-config-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/cPanel-edit-wp-config-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]The file will open in the default cPanel editor, so <strong>you only need to add the<\/strong> <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define('WP_DEBUG', true);<\/code> above the<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> \/* That's all, stop editing! Happy blogging. *\/<\/code> line of code within the wp-config file.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>If the file already contains the following line<\/strong> <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define('WP_DEBUG', false);<\/code>\u00a0<strong>simply change the false to true and click on \u201cSave Changes\u201d in the top-right corner of your screen.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Change-the-false-to-true.jpg\" class=\"attachment-full size-full\" alt=\"Change the false to true\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Change-the-false-to-true.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Change-the-false-to-true-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Change-the-false-to-true-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;59px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to Manage Displaying Errors<\/h2>\n<p>[\/vc_column_text][vc_column_text]Once you successfully display the errors, they will show on your pages, both on the backend and frontend. Unless your site is in development, exposing the errors live clearly isn\u2019t a good idea. Instead, you should save them as a single file and hide them from your site. This will allow you to view the file later and troubleshoot errors at any time.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To do this, <strong>add this code to your wp-config.php file<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define( 'WP_DEBUG_LOG', true );\r\ndefine( 'WP_DEBUG_DISPLAY', false );\r\n@ini_set( 'display_errors', 0 );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;18px&#8221;][vc_column_text]Add the code below the following line <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define('WP_DEBUG', true);\u00a0<\/code> and above the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/* That's all, stop editing! Happy blogging. *\/<\/code> line of code.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]You can edit the file using an FTP client or via cPanel, following the same steps we laid out in the previous section. After the edit, your wp-config.php file should look like this.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Managing-the-visibility-of-errors.jpg\" class=\"attachment-full size-full\" alt=\"Managing the visibility of errors\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Managing-the-visibility-of-errors.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Managing-the-visibility-of-errors-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Managing-the-visibility-of-errors-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]By adding define( &#8216;WP_DEBUG_LOG&#8217;, true ); we force WordPress to store all the error messages into one file. By default, that file is called debug.log and it is located in your-WordPress-root\/wp-content\/ directory. You can also store error messages in some other file that you created. In that case, change the true from \u201cdefine( &#8216;WP_DEBUG_LOG&#8217;, true );\u201d to the path of the file. For example:[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define( 'WP_DEBUG_LOG', path-to-your-site\/wp-content\/error.log );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;18px&#8221;][vc_column_text]Furthermore, <strong>WP_DEBUG_DISPLAY determines whether the error messages are shown or hidden on the screen<\/strong>. By adding define( &#8216;WP_DEBUG_DISPLAY&#8217;, false ); you tell WordPress to hide the messages from your screen, but they are still printed to the designated file. If you also <strong>add @ini_set( &#8216;display_errors&#8217;, 0 ); this will disable error printing for your PHP<\/strong>, making sure that users will not be able to see them on the frontend.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;50px&#8221;][vc_widget_sidebar sidebar_id=&#8221;top-picks-banner&#8221;][vc_empty_space height=&#8221;28px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;60px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Acquiring the Error Log<\/h2>\n<p>[\/vc_column_text][vc_column_text]With the errors shown and successfully written in the appropriate error log file, the only thing that remains is to review the error messages and take further steps. [\/vc_column_text][vc_empty_space height=&#8221;42px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Manually Downloading debug.log File<\/h3>\n<p>[\/vc_column_text][vc_column_text]To download the log file connect to your server, navigate to your <strong>root WordPress folder<\/strong> and click on <strong>wp-content<\/strong>. Find the <strong>debug.log<\/strong> file inside, <strong>right-click<\/strong> on it and press \u201c<strong>Download<\/strong>\u201d.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-downloading-debug.log-file.jpg\" class=\"attachment-full size-full\" alt=\"Manually downloading debug.log file\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-downloading-debug.log-file.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-downloading-debug.log-file-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/Manually-downloading-debug.log-file-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Save the file on your desktop. Then, make sure to revert the previous edits. This includes removing the code you inserted and changing the permissions on the wp-config.php file to 440 or 400. If you want, you can do this after solving the errors.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Finally, open the saved debug.log file with a text editor and check the error messages written. Depending on your level of expertise, you can either solve the errors yourself or <a href=\"https:\/\/relevant.software\/blog\/hiring-remote-software-developers\/\" target=\"_blank\" rel=\"noopener\">hire a developer<\/a>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">More Advanced Debugging Features<\/h2>\n<p>[\/vc_column_text][vc_column_text]We will also take a look at some more advanced debugging possibilities. The following code should be added in wp-config.php, above the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/* That's all, stop editing! Happy blogging. *\/<\/code> line.[\/vc_column_text][vc_empty_space height=&#8221;38px&#8221;]<div class=\"qodef-ordered-list-item \">\n\t        <div class=\"qodef-ol-title-holder\">\n            <span class=\"qodef-ol-title-number\">1.<\/span>\n            <span class=\"qodef-ol-title-content\">define( &#8216;SCRIPT_DEBUG&#8217;, true );<\/span>        <\/div>\n    <\/div>[vc_empty_space height=&#8221;12px&#8221;][vc_column_text]<strong>This code forces WordPress to use un-minified versions of CSS and JS files<\/strong>, which is useful for debugging changes and\/or errors found specifically in your CSS and JS files.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/SCRIPT_DEBUG.jpg\" class=\"attachment-full size-full\" alt=\"SCRIPT_DEBUG\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/SCRIPT_DEBUG.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/SCRIPT_DEBUG-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/SCRIPT_DEBUG-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;48px&#8221;]<div class=\"qodef-ordered-list-item \">\n\t        <div class=\"qodef-ol-title-holder\">\n            <span class=\"qodef-ol-title-number\">2.<\/span>\n            <span class=\"qodef-ol-title-content\">define( &#8216;CONCATENATE_SCRIPTS&#8217;, false );<\/span>        <\/div>\n    <\/div>[vc_empty_space height=&#8221;12px&#8221;][vc_column_text]By setting CONCATENATE_SCRIPTS constant to false, you force <strong>WordPress to load all scripts separately<\/strong>. This can prove useful for pinpointing faulty\/incompatible scripts.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/CONCATENATE_SCRIPTS.jpg\" class=\"attachment-full size-full\" alt=\"CONCATENATE_SCRIPTS\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/CONCATENATE_SCRIPTS.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/CONCATENATE_SCRIPTS-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/CONCATENATE_SCRIPTS-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;48px&#8221;]<div class=\"qodef-ordered-list-item \">\n\t        <div class=\"qodef-ol-title-holder\">\n            <span class=\"qodef-ol-title-number\">2.<\/span>\n            <span class=\"qodef-ol-title-content\">define( &#8216;SAVEQUERIES&#8217;, true );<\/span>        <\/div>\n    <\/div>[vc_empty_space height=&#8221;12px&#8221;][vc_column_text]If you are experiencing database issues, analyzing the queries that are run is a good way to start debugging. By inserting the code above you will <strong>put the query content, which function called it and for how long it was run in $wpdb-&gt;queries array<\/strong>. This will allow you to dive deeper into the backend portion of the theme\u2019s code and what it is doing exactly.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/More-advanced-debugging-features.jpg\" class=\"attachment-full size-full\" alt=\"More advanced debugging features\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/More-advanced-debugging-features.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/More-advanced-debugging-features-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/03\/More-advanced-debugging-features-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]You can then <strong>add the following code to show all the queries in a readable form<\/strong> and analyze them.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">global $wpdb;\r\nprint(\"&lt;pre&gt;\".print_r($wpdb-&gt;queries,true).\"&lt;\/pre&gt;\");<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;18px&#8221;][vc_column_text]However, keep in mind that this code will affect your site\u2019s performance, so we recommend using it for debugging purposes only.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Final Thoughts<\/h2>\n<p>[\/vc_column_text][vc_column_text]Following this guide, you can show and safely store error logs in a file, change file permissions, and run some debugging features intended for more advanced WordPress users. This tutorial will also help you learn more about the way your website works &#8211; so keep it close because you could need these instructions in the future.[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>The error log contains errors, warnings, and notices about the code behind your site. In this guide, learn how to turn on the error logs in WordPress.<\/p>\n","protected":false},"author":11229,"featured_media":5486,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[4,52,13],"class_list":["post-5427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-tips","tag-troubleshooting","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/5427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/11229"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=5427"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/5427\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/5486"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=5427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=5427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=5427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}