Disabling Minification on Core WordPress JavaScript Files | GBTI
- devops
- frameworks
- wordpress
Sometimes, it becomes necessary to edit core WordPress files directly, inside a non production environment, to better understand the behavior of the WordPress platform and pinpoint specific problems. By default, WordPress combines and compresses its JavaScript files to improve performance, but this can make it difficult to trace issues or make modifications.
This tutorial will guide you through the steps to disable these features, allowing you to work with the original, unminified files.
Editing wp-config.php directly to disable minification.
To disable script concatenation and compression, add the following lines to the wp-config.php file:
define('CONCATENATE_SCRIPTS', false); define('SCRIPT_DEBUG', true);
Editing functions.php directly to disable minifications.
To disable script minification and concatenation via your theme’s functions.php file, add the following code:
add_filter('script_loader_src', 'disable_minification', 10, 2); add_filter('style_loader_src', 'disable_minification', 10, 2); function disable_minification($src, $handle) { if (strpos($src, '.min.') !== false) { $src = str_replace('.min.', '.', $src); } return $src; }
Additional considerations
Direct modification of core WordPress files is generally discouraged due to the following reasons:
- Changes will be overwritten during updates.
- It may lead to unexpected behavior if not executed properly.
Preferably, use hooks, filters, or plugins to implement changes. For those needing to directly edit JavaScript files, creating a custom plugin or theme to include the custom scripts is advised.

We hope you enjoyed this article by Hudson Atwell, GBTI Member.
Python, NextJS, NodeJS, JavaScript, PHP, WordPress, Developer Relations, Novelty, Curation, DevOps, Blockchain, IoT, and more.
0 Comments
No comments yet. Be the first. Members comment from the GBTI local client, where comments are submitted as pull requests and auto-published for paid members.
Become a memberMembers write comments from the GBTI client or browser extension. Become a member to join the conversation.