{"id":106,"date":"2022-04-04T08:34:40","date_gmt":"2022-04-04T08:34:40","guid":{"rendered":"https:\/\/help.radia.cloud\/en\/?post_type=base-de-conocimieto&#038;p=106"},"modified":"2022-04-04T08:34:41","modified_gmt":"2022-04-04T08:34:41","slug":"how-to-enable-wordpress-debug-php-errors-wp_debug","status":"publish","type":"base-de-conocimieto","link":"https:\/\/help.radia.cloud\/en\/article\/how-to-enable-wordpress-debug-php-errors-wp_debug\/","title":{"rendered":"How to enable WordPress Debug \/ PHP Errors (WP_DEBUG)"},"content":{"rendered":"\n<p>When adding custom code such as PHP or JavaScript, there are times when you may need to find any possible errors in your code.<\/p>\n\n\n\n<p>When enabled, WordPress debug will log any errors detected on your site. This can be key to finding the source of an issue or just learning more details about any possible errors on your site.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Enabling debug in WordPress<\/h3>\n\n\n\n<p>To enable debugging on your site, please follow the steps below.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1) Locating the&nbsp;<code>wp-config.php<\/code>&nbsp;file<\/h4>\n\n\n\n<p>By default, WordPress debug will be disabled. To enable it, you\u2019ll need to access your site files through either FTP or cPanel.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2) Editing the&nbsp;<code>wp-config.php<\/code>&nbsp;file<\/h4>\n\n\n\n<p>Once your site files are open, you\u2019ll need to open\u00a0<code>wp-config.php<\/code>\u00a0for editing. This will be located in the root folder of your site.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"645\" src=\"https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-1024x645.png\" alt=\"\" class=\"wp-image-108\" srcset=\"https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-1024x645.png 1024w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-300x189.png 300w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-768x484.png 768w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-585x369.png 585w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp-1170x737.png 1170w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/ftp.png 1266w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The wp-config file contains site-specific configuration settings, such as database information and, potentially, settings added by your hosting provider. For debugging, you\u2019ll need to find this line of code (will generally be near bottom of file):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>(&#8216;WP_DEBUG&#8217;,false);<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Accessing the website at this point, would likely show you errors \/ debug output so that you can diagnose the problem with your site. Failing that, you can further your logging below.<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">3) Adding your&nbsp;<code>debug<\/code>&nbsp;code<\/h4>\n\n\n\n<p>Copy and paste this code snippet over the line of code mentioned in&nbsp;<strong>Step 2<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Enable WP_DEBUG mode<br>define( 'WP_DEBUG', true );<br> <br>\/\/ Enable Debug logging to the \/wp-content\/debug.log file<br>define( 'WP_DEBUG_LOG', true );<br> <br>\/\/ Disable display of errors and warnings<br>define( 'WP_DEBUG_DISPLAY', false );<br>@ini_set( 'display_errors', 0 );<br> <br>\/\/ Use dev versions of core JS and CSS files (only needed if you are modifying these core files)<br>define( 'SCRIPT_DEBUG', true );<\/pre>\n\n\n\n<p>This code will need to be to inserted\u00a0<strong>before<\/strong>\u00a0the comment \/* That\u2019s all, stop editing! Happy blogging. *\/ in the wp-config,php file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"986\" src=\"https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-1024x986.jpg\" alt=\"\" class=\"wp-image-109\" srcset=\"https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-1024x986.jpg 1024w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-300x289.jpg 300w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-768x740.jpg 768w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-585x563.jpg 585w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code-1170x1127.jpg 1170w, https:\/\/help.radia.cloud\/en\/wp-content\/uploads\/sites\/4\/2022\/04\/wpforms-debug-code.jpg 1514w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This will enable debugging and, importantly, prevent any logged data from displaying on your site. Instead, a debug log will be saved to your site files.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">4) Replicating the issue<\/h4>\n\n\n\n<p>After saving these changes to&nbsp;<code>wp-config.php<\/code>, you\u2019ll need to return to your site and replicate the issue you saw earlier. This will ensure that it gets recorded in the new error log.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">5) Viewing the debug log<\/h4>\n\n\n\n<p>Then, you can return to your site files and open&nbsp;<code>\/wp-content\/debug.log<\/code>.<\/p>\n\n\n\n<p>The contents of an error log can vary a lot depending on the cause and number of issues, but now you should be able to see extra details, such as a file path to the source of a code error, to help you better track down the issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When adding custom code such as PHP or JavaScript, there are times when you may need to find any possible errors in your code. When enabled, WordPress debug will log any errors detected on your site. This can be key to finding the source of an issue or just learning more details about any possible [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":""},"bdctema":[29,26],"bdcetiqueta":[47,46,49,50,48],"_links":{"self":[{"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/base-de-conocimieto\/106"}],"collection":[{"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/base-de-conocimieto"}],"about":[{"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/types\/base-de-conocimieto"}],"author":[{"embeddable":true,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":1,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/base-de-conocimieto\/106\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/base-de-conocimieto\/106\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"bdctema","embeddable":true,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/bdctema?post=106"},{"taxonomy":"bdcetiqueta","embeddable":true,"href":"https:\/\/help.radia.cloud\/en\/wp-json\/wp\/v2\/bdcetiqueta?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}