CSS @import being removed?
-
Why is my CSS @import for google fonts being removed every time I save my customized css file?
The blog I need help with is: (visible only to logged in users)
-
Hi @michellelherman,
Staff will have a look at this case, but seems on WordPress.com Jetpack stripes out everything that is not a CSS element or in our case everything that includes other CSS file (f.e @font-face appears without a link too). I think that is for security reasons.
If there is no font that is suitable for you in Fonts directory, then I suggest you to use a plugin like this to get access to Google and Adobe fonts: https://wordpress.com/plugins/olympus-google-fonts. However to install a plugin you need to purchase a Business or eCommerce plan.
-
Hi there,
We do not allow the use of
@importin custom CSS on WordPress.com, no, as that can also be used to load malicious scripts on a site. You can find details on the code restrictions on WordPress.com here:https://wordpress.com/support/code/
WordPress.com comes with a number of Google fonts built in, and you can change your theme’s font under the Fonts section in the Customizer:
https://wordpress.com/support/custom-fonts/
If the font you want to use is not available there, the only other way to add your own fonts is by using a plugin like Easy Google Fonts, or else creating a child theme so you can add the import command directly to the theme’s
style.cssfile. Using plugins or child themes require our Business Plan.Let me know if you have any questions.
-
Jetpack does not strip out anything appearing on a site. That would be an extremely invasive thing for any plugin to do. All Jetpack does is connect a self-hosted WordPress site to a WordPress.com account, adding certain features and services we offer to the site.
In this case Jetpack also has nothing to do with the issue, as the OP has a WordPress.com-hosted site where Jetpack features are built in, so they’re not using the Jetpack plugin.
-
Hi @kokkieh,
Thanks for info as always!
You are right, I didn’t have to mention Jetpack as there is no chance to uninstall it on WordPress.com.
Please comment on my ideas why I have decided Jetpack is involved:
As long as Jetpack has some really cool features like CSS History mentioned here https://jetpack.com/support/custom-css/ and many security features, I thought it affects saving the CSS by deleting potentially unsafe links too.
The other reason that was combined with the first one is that WordPress installation on Local environment allows usage of@importand does not delete it.
So if Jetpack is not affecting the a/m behavior, then it must be something else added to WordPress installation used on WordPress.com? -
I thought it affects saving the CSS by deleting potentially unsafe links too.
It does not, no. Unless you can point to something in Jetpack’s documentation saying it does this, please don’t make assumptions :)
The other reason that was combined with the first one is that WordPress installation on Local environment allows usage of @import and does not delete it.
This is a difference between the open source WordPress software, and the managed hosting environment we have on WordPress.com, where we also use a modified version of that software. WordPress.com has a lot of features that doesn’t exist in the open source software, and many things are possible on the open source software that we don’t have available or don’t allow on WordPress.com.
-
where we also use a modified version of that software.
Good to know, because I thought WordPress software has to be same to allow smooth upgrades and plugins have to be used “on top” to modify it. So that is true for ordinary WordPress users only. Very good to know.
please don’t make assumptions :)
That is so
!important!
- The topic ‘CSS @import being removed?’ is closed to new replies.