I tried to upload fonts in WordPress in wp-includes/fonts
. Then I go in Apperance -> Editor -> Style.css
and here I have something like this
@font-face {
font-family: helvetica_light;
src: url(/wp-includes/fonts/helvetica_light.otf);
}
You should never touch any files in wp-includes
or wp-admin
. Why? Because the next time you update WordPress, any changes you made will get erased.
Option 1 - Easy
If you want to use Google fonts with your WordPress theme, try a plugin like Easy Google Fonts or WP Google Fonts.
Option 2 - More Work
If you want to programmatically add Google fonts without using a plugin, you'd paste this code in your themes' functions.php
file.
Note: there is no Helvetica Light font available from Google. Open Sans seems to be a close match though.
function my_custom_google_fonts() {
wp_enqueue_style( 'my-google-fonts', '//fonts.googleapis.com/css?family=Open+Sans:300,400', false );
}
add_action( 'wp_enqueue_scripts', 'my_custom_google_fonts' );
Then you need to reference that new font in your themes' style.css
file.
body {
font-family: 'Open Sans', sans-serif;
}
If the font is installed on your computer, your browser will show it on your site, regardless of whether the font has been loaded. So I'd start with checking the site on a different device and see if the font shows up there. If not, check the path to the font. Url's in stylesheets are relative to the location of the sheet, not of the site root. That should enable you to make sure the font is really loaded on all devices.
Now to the error. Apparently there is code in your site that tries to load any font mentioned in your css file from Google. The error is thrown because Google doesn't know this font. The ver4.6.1
at the end of the url is the current WordPress version, which is most likely generated by a call to wp_enqueue_style
or wp_register_style
. That call is wrong anyway, because Google doesn't like the version part and would throw an error even if the font did exist (the $ver
parameter should be null
).
Without further knowledge it's impossible to say where this code is. I'd start with checking the theme's functions.php
, but it may also be some font related plugin.