How to Fix WordPress CSS & JS From Breaking

I recently came across a strange WordPress issue that was driving me up a wall. After completing a fresh install in a MAMP environment, I was having intermittent issues where it appeared the CSS and JS wasn’t getting loaded in the admin dashboard.

Ever run into CSS or JS failing to load when working on a WordPress project locally? Me too!!! I even tried a fresh install using MAMP, but still got intermittent issues. It was driving me nuts until I did a little googling and found what the problem was.

WordPress loadscripts Screenshot Error

If you’re seeing something like what’s shown above, you’re probably having the same issue I was with the load-scripts.php and load-styles.php files. I was surprised to see on a fresh install of WordPress, console was returning a bunch of CSS and JS errors. I took a look at one of the problem files, load-scripts.php from the console and found:

WordPress load-scripts.php Console Error

Yikes! Initially I thought my install got corrupted somehow, so tried to re-installing WordPress again with no luck. After digging around, I came across this post by Michael Novotny.

Basically, he found that hacking a WordPress core file — which is a big no-no, could fix the problem. In wp-admin/load-styles.php he replaced this line:



error_reporting( E_ALL | E_STRICT );

and Viola! All was working again. Although like I said, editing a core WordPress file is never a good idea.

The Solution

So what’s a good fix for this bug? One of Michael’s readers, Dan, posted a comment in response to his post:

I also had this issue with MAMP pro. I found that adding:

define( 'CONCATENATE_SCRIPTS', false );

to wp-config.php worked as well. Perhaps you might feel a little better modifying config file over a core file.

This is a much better fix instead of hacking at WordPress’s core files. So in wp-config.php at the bottom of your file, place the following code:

define( 'CONCATENATE_SCRIPTS', false );

Check out this article by Jean Galea for further reading on this pesky bug.

Author: Ben Marshall

Red Bull Addict, Self-Proclaimed Grill Master, Entrepreneur, Workaholic, Front End Engineer, SEO/SM Strategist, Web Developer, Blogger

One thought on “How to Fix WordPress CSS & JS From Breaking”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.