wp-rocket
wp-rocket copied to clipboard
Preload Fonts: installation subfolder name is stripped from URLs
When saving URLs to Preload Fonts, the domain name is stripped automatically -- but in the case of a subdirectory installation, the subfolder name is also being removed, which results in an invalid URL being preloaded on the front end.
- Must have WordPress Site URL located in a subfolder, e.g., https://example.com/sub/
- Need at least one font URL to test, e.g., https://example.com/sub/wp-content/themes/twentytwenty/assets/fonts/inter/Inter-upright-var.woff2
- Add the URL to the Preload Fonts field, then save the change.
- See that the subfolder has also been removed from the URL:
- On the front end, the domain will be added back, but not the subfolder:
<link rel="preload" as="font" href="https://example.com/wp-content/themes/twentytwenty/assets/fonts/inter/Inter-upright-var.woff2" crossorigin>
- Thus, the font's URL is invalid and it cannot actually be preloaded.
Related: https://secure.helpscout.net/conversation/2438758491/461019/