How to Fix WordPress Admin Styles Not Loading
I recently got a brand new computer and took the opportunity to clean up my local development environment. That meant a fresh installation of MAMP Pro and some new databases.
I got everything setup and I was settling in for a good evening of side hustle when I saw this in my WordPress admin.
All WordPress admin CSS styles were missing! Turns out none of the WordPress admin styles were not loading.
Super...
I wasn’t sure what was going on... I tried to reinstall WordPress a couple of times, but it didn't change anyhting, so intense Google searching ensued.
I cannot remember how many articles I read or how many suggested hacks I attempted. I do know it took well over an hour and none of them worked. I eventually found something buried deep in some sketchy looking site, but it worked! I am not trying to withhold credit to the person or site who suggested it. I simply did not think to save the URK at the time. Regardless, this is what the article suggested.
And let me be clear... I do not encourage WordPress core hacks, but in the moment, I just wanted it fixed so I could start working on what I wanted to do for the evening.
In the wp-admin/load-styles.php
file, find this line of code...
error_reporting(0);
...and change it to this...
error_reporting( E_ALL | E_STRICT );
...and then simply refresh your WordPress admin screen a few times. You should see the WordPress admin CSS styles come back to normal.
And that’s it! You do not even have to leave this WordPress core hack in place. Once the admin styles are back and dsiplaying correctly, you can revert the line of code back to what it was and it should still keep working.
Bizarre... I know.
A user suggested, non-WordPress core hack that might work for some is to add the following code to your wp-config.php
file, before any require_once
calls.
define( ‘CONCATENATE_SCRIPTS’, false );
define( ‘SCRIPT_DEBUG’, true );
It certainly feels better than modifying the WordPress core, but it only seems to work some of the time.
So if you ever run across this, perhaps it can save you some time and get you back on track. I am not saying this will work in all cases of the WordPress admin not loading the styles, but this is what worked for me and for others who've tweeted me over the years.
I have no idea why this works, so if you have a more technical or detailed explanation of why, then I would love to hear from you.
I have also never had this happen again, otherwise, I will dig in much deeper next time to see if I can identify a root cause within WordPress itself and supply a patch to core.