brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: SCRIPT_DEBUG makes WordPress load the unminified scripts and styles

WordPress
~/tips/tip-wordpress-script-debug

define( 'SCRIPT_DEBUG', true );

Makes WordPress load readable, unminified core scripts and styles so browser errors are traceable.

Reading a JavaScript error that points to line 1, column 48213 of a minified file is no fun. WordPress has a constant that hands you the readable versions of its own scripts and styles.

define( 'SCRIPT_DEBUG', true );

Put it in wp-config.php. WordPress then loads the development versions of its built-in JavaScript and CSS instead of the minified ones, so a stack trace in the browser console shows real function names and sensible line numbers. It is meant for people who change WordPress’s own scripts or who need to understand an error that comes from them.

Combine it with the debug log settings when you are hunting a problem:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Caveats: the unminified files are larger and the page loads slower, which is why this belongs on a development or staging copy and not on the live site. Also check the result in a private window or after a hard reload, since an old cached minified file will hide the effect. Plugins and themes only follow the setting when they use the standard registration functions, so a plugin that ships its own minified file may not change.

Set it back to false or delete the line when you are done.

Further reading: Editing wp-config.php, SCRIPT_DEBUG (WordPress Advanced Administration)

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link