Deregister Open Sans from WordPress Admin
WordPress, Workflow
WordPress enqueues the Open Sans font in the admin area. This requires making a request to Google Fonts, which obviously isn’t going to work if you are offline.
This can be very problematic if you’re developing locally and you lose the internet connection. The local site becomes extremely slow as the request to Google Fonts does it’s thing.
This caught me off guard at first - I blocked my own custom script calls and couldn’t understand what was messing up the local site. It’s WP core calling Google.
The following hack removes Open Sans from the admin area. Add this code to your theme and uncomment the add_action()
.
Remove Open Sans
If you don’t use namespacing you won’t need __NAMESPACE__ . '\\
in the callback reference.
Seems like a lot of hassle just for a pretty basic admin font. Maybe the enqueuing function could be wrapped in a conditional that pings Google Fonts?
I think core should use system fonts by default - if we need to prettify the admin area, that should be a theme-level decision.
References
comments powered by Disqus