#55985 - Remove Google fonts from Twenty Twelve #2920
#55985 - Remove Google fonts from Twenty Twelve #2920Luehrsen wants to merge 15 commits intoWordPress:trunkfrom
Conversation
Co-authored-by: Carolina Nymark <hi@themesbycarolina.com>
|
|
||
| return $urls; | ||
| } | ||
| add_filter( 'wp_resource_hints', 'twentytwelve_resource_hints', 10, 2 ); |
There was a problem hiding this comment.
The resource hint filter should not return an empty string for everyone run without making changes for anyone. We could simply remove the add_filter line and add a deprecated comment in the documentation (under since). Then anyone who still has a custom Google URL could add this pre-defined filter in a child theme or plugin.
There was a problem hiding this comment.
I've updated the PR to remove the whole filter function. I'm unsure about the deprecation note, can you maybe take a look at it, @sabernhardt?
There was a problem hiding this comment.
My point was to leave the twentytwelve_resource_hints function intact. The version number in that example PR is outdated, but I only added one line to the documentation and removed the one line that calls the function.
Child themes can still use Google URLs, especially if their font selection is different, and some of those sites' owners may want to continue employing that filter.
There was a problem hiding this comment.
Should we just comment out the line with add_filter?
There was a problem hiding this comment.
Commenting out the line might be better. That would show what was removed (and could be restored) even without explaining it in the DocBlock.
There was a problem hiding this comment.
I've just adapted the changes from your PR to this PR. I hope I got it all.
|
Perhaps this has been asked and answered somewhere else, but is it possible to keep the "font subsets" to optimize loading of font files similarly to how they are loaded from the Google's CDN? Looking at the code, this part that is now removed: Seems that loading |
|
@azaozz The Google font stylesheet already includes all subsets even if the URL specifies only |
Yes, what I am asking is if it is possible to include only the needed subset(s). There is no point in the browser downloading all 64 font files on every front-end page load. This seems like a considerable slow down and a large amount of unneeded files, wasted bandwidth, etc. Looking at https://fontsource.org/fonts/open-sans and the repo at https://github.com/fontsource/fontsource/tree/main/fonts/google/open-sans, there are ready-made CSS files that can probably be adjusted and used. For example: https://github.com/fontsource/fontsource/blob/main/fonts/google/open-sans/400.css (the .ttf and .woff font files for the whole Open Sans can be downloaded from the first link). |
Very rarely will the user agent download all fonts. That is why the See: https://w3c.github.io/csswg-drafts/css-fonts/#font-prop-desc
|
and add a deprecation notice to documentation
…/Luehrsen/wordpress-develop into update/google-font-twenty-twelve
This reverts commit 4f281b6.
and handle documentation
This pull request aims to remove google webfont requests from core themes and serve needed fonts locally.
Trac ticket: https://core.trac.wordpress.org/ticket/55985#ticket
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.