13

Enable WordPress Debug Mode - Pine

 4 years ago
source link: https://pineco.de/snippets/enable-wordpress-debug-mode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Enable WordPress Debug Mode

We use cookies for commenting and analytics. For more details, please visit our privacy page.

Ugrás a tartalomhoz

Home Snippets WordPress Enable WordPress Debug Mode

WordPress debug mode enables us to see the errors when we develop. It is a necessary step when building something new to be sure that our code works well.

To turn on the debug mode, we have to set the WP_DEBUG constant in the wp-config.php to true:

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

We can also set up (also in the wp-config.php file) where we want to see the errors and warnings, in a log file or on the site:

// Debug logging into a separate file (/wp-content/debug.log)
define('WP_DEBUG_LOG', true);
// Disable error and warning display on site
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

We can also load the development versions of the core JS and CSS files to simplify debugging:

// Load the development versions of core JS and CSS files
define('SCRIPT_DEBUG', true);

The fully enable a manageable WordPress debug setup use the following code:

// Enable WP_DEBUG mode with logging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
define('SCRIPT_DEBUG', true);

Note that you can also use it on a live site because the messages are only shown in a log file.

Need a web developer? Maybe we can help, get in touch!

To see and write comments, you must allow the related (Disqus) cookies. For more information, please visit our privacy policy page.

Need a reliable, small web developer team? Try us! We develop with Laravel and Vue.js.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK