CAOS for Webfonts | Host Google Fonts Locally

Opis

CAOS for Webfonts is written with performance in mind. Other plugins make repeated requests to your Blog’s database to replace/remove requests to external Webfonts source (e.g. Google Fonts) on-the-fly. This might be user-friendly, but it’s a performance killer, because locally hosting your Google Webfonts should be a set-and-forget feature. The source of your webfonts should be replaced once and kept that way.

That’s why I kept CAOS for Webfonts small and useful. It uses the Google Fonts Helper API to automagically download the fonts you want to WordPress’ contents folder and generate a stylesheet for it. The stylesheet is automatically included to your site’s header and 100% compatible with plugins like Autoptimize or W3 Total Cache. After that, all you need to do is remove any mention of requests to external webfont sources (using e.g. a child theme or a plugin such as Autoptimize) and you’re done!

This will decrease your pageload times, leverage browser cache, minimize DNS requests and effectively bring you a perfect score on Pagespeed Insights and Pingdom, without taking toll on the performance of your webserver.

Features

  • Easily find and download your fonts in multiple subsets,
  • Generate a stylesheet, which is automatically added to your header using WordPress’ wp_head()-function,
  • Change the caching path (where the fonts and stylesheet are saved) for increased compatibility with Caching- and Security-plugins, such as WP Super Cache, Autoptimize and WordFence,
  • Control font performance by adding font-display property,
  • Prioritize fonts with rel=’preload’.

Instalacja

  1. Upload the plugin files to the /wp-content/plugins/host-webfonts-local directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‚Plugins’ screen in WordPress
  3. Use the Settings -> Optimize Webfonts screen to configure the plugin

For a more comprehensive guide for configuration, click here.

FAQ

I don’t know what I’m doing! Can you help?

Of course 🙂 But first calm down and read this comprehensive guide on how to configure CAOS for Webfonts. If you have any questions afterwards, visit the Support Forum.

I have another file I want to host locally. Could you make a plugin?

Maintaining two plugins besides my daily 9-to-5 job is a handful, so no. If you’re looking for a way to host analytics.js locally; please install CAOS for Analytics. For anything else, please follow the steps in this how-to.

How come my font isn’t available in CAOS for Webfonts?

This could be for several reasons:
1. Have you checked if your font is available on Google Fonts?
1. Is your font listed as an open source font, or is it a premium font? For obvious reasons, CAOS for Webfonts only has access to open source fonts.

Can I serve the fonts from my CDN?

Yes, you can. Enter the url of your CDN and re-download and re-generate the stylesheet. Then the fonts will be saved to and served from your CDN.

Does this plugin edit template files?

No, it does not. It creates a CSS Stylesheet which will be automatically added to your theme’s header using a built-in WordPress queueing system.

My fonts aren’t being downloaded! What’s going on?

First check your database if the table {prefix}_caos_webfonts exists. If you’re using any caching plugins, such as Autoptimize, W3TC or WP Super Cache, empty their caches. After that empty your browser’s cache and reload the page. Try again.

The stylesheet isn’t loaded? What’s going on?

CAOS for Webfonts enqueues the stylesheet into WordPress’ head. If the stylesheet isn’t loaded, this probably means your theme isn’t implementing the wp_head() function into it’s header section.

Does this plugin support Multi Site?

Yes, it does!

Can I buy you a beer?

Yes, please! Click here to buy me a beer!

Recenzje

Lipiec 9, 2019
I used to do that manually, which was fine but quite annoying. Your plugin saves me a lot of time. Not only it works great but it has some cool feature. Thanks again to make our life easier 😉 Cheers
Czerwiec 21, 2019
It's clear that this plugin is helping some people. I had a different experience however. Now to be fair, my website is loading anywhere between 1.4 and 2.6 seconds during tests. But it always mentions google fonts as being an issue, so I thought i'd try this plugin. Once I activated it and downloaded the webfonts etc, all tests I did changed my websites load time to between 5 and 8 seconds. I checked the timings and on every single occassion the new fonts.css was the issue for some reason. I deactivated the plugin and everything is back to normal.
Maj 25, 2019
As I loved the google fonts, I did not like the fact that I had to wait for them to show up on my theme when they got fully loaded. Now hosting them locally resolved me a lot of loading time and my theme looks more professional because I won't change the font layout until the "slow" Google fonts are loaded. Also promoted it on CMM (centmin mod) to use your plugin on the default installer, but not allowed to post links here. We use Autoptimze by default, so disabling the Google fonts was a job of just a click. Again, thanks for your time that you spend in creating this great plugin, just looking to host other js locally. Also it works on WP 5.
Maj 4, 2019
Even this Plugin does the job, why making things more complicated as they are? First loading google fonts and then trying to eliminate fonts not used? There is a tiny plugin which does all the huzzle more efficient and even much more easier. The plugin just takes the Google Fonts already in use and stores them locally, done. Plug and Play with no docs and no do this and that.
Przeczytaj 15 recenzji

Kontrybutorzy i deweloperzy

„CAOS for Webfonts | Host Google Fonts Locally” jest oprogramowaniem open source. Poniższe osoby miały wkład w rozwój wtyczki.

Zaangażowani

Log zmian

1.8.0

Minor code optimizations.

1.7.9

Cleared up instructions in Welcome Panel.
Added option to remove version parameter from stylesheet request.

1.7.8

Updated welcome panel.

1.7.7

Quick-fix for re-triggered SQL queries.

1.7.6

XSS hardening in stylesheet generation form.

1.7.5

Added CDN support.

1.7.4

Fluid progress bar now functions correctly and doesn’t make any unnecessary Ajax-requests.
Replaced all success-messages with notifications inside the buttons, to increase UX.

1.7.3

Improved search by adding support for comma-separated lists. Fixed some 404s in welcome panel and minor JavaScript optimizations.

1.7.2

Minor usability updates.

1.7.0

Added support for subsets to increase compatibility with other writing.

1.6.1

Changed domains to new home: daan.dev

1.6.0

Added experimental option for preload resource hint.

1.5.7

Replaced download counter for progress-bar. Refactored logic for AJAX-requests for better
performance.

1.5.6

Optimized AJAX-requests for download-counter.

1.5.5

Added a clean-up button, which cleans the currently configured cache-dir.

1.5.3

Plugins admin-JS and -CSS is now updated by force after plugin update to prevent malfunction.

1.5.2

Added a download counter, clean queue-button and improved allround UX. Fixed a few minor bugs.

1.5.1

Fixed a bug where sometimes the fonts weren’t downloaded yet when the stylesheet was generated.

1.5.0

CAOS for Webfonts now remembers which fonts you use, to make it easier to edit your stylesheet.

1.4.1

Added option to change font-display strategy.

1.4.0

Added option to change cache directory.

1.3.10

Fixed bug with detecting wp-content directory.

1.3.9

Fixed Multisite Bug.

1.3.8

Revert accidental commit

1.3.7

Tested with WP 5+

1.3.6

Changed order of loaded fonts to improve compatibility in Firefox. [Reported by @lofesa]

1.3.5

When plugin is deactivated, enqueued styles and scripts are removed. Fixed bug where fontnames containing multiple spaces did not return any results. Added console log when no results are returned.

1.3.2

Finally added ‚Settings’-link to Plugins-page.

1.3.1

Further security measures to remove Path Traversal vulnerabilities.

1.2.9

Added security measures to prevent XSS.

1.2.8

Fixed bug where ‚remove’ would sometimes remove two rows.

1.2.5

Complete overhaul of the plugin. Fonts are now searched using the Google Fonts Helper API and

1.1.0

Fixed bug where the plugin would sometimes permanently change your uploads-directory to /local-fonts.

1.0.1

Changed to Github.

1.0

First release! No changes so far!