-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom CSS: add option to disable in theme.json #50761
Comments
Is there a use case for this, that can't be covered by user permissions? Wouldn't this turn it off for all users including admin? |
I am not sure. I guess there could be instances in some more heavily locked down corporate sites, etc. where you don't want anyone adding additional custom CSS via the admin interface. Many of the other global styles can be disabled via theme.json, so allowing it for custom CSS makes sense in terms of consistency. |
Hi, I was the original commenter! :) So yes I have admin users and want to block them from adding CSS to a block. Yes I could make a user role that's somewhere between editor & admin, but easier and more readable in my opinion to just disable in the theme.json. I could also see a theme author with a very stylized, highly opinionated theme and they want to block users from adding CSS to say the heading block which would break precise block patterns in unexpected ways. |
I thought I would take a stab at some discovery here. I'm likely in over my head 😄 Some items worth discussing: Location of the new setting in
|
I discussed this briefly with @Mamaduka and he provided me some areas to explore in the codebase that could possibly be extended or referenced for any of this work. He mentioned that he had worked on some of the user capabilities for Custom CSS implementation and pointed me to search for Another possible consideration would be elevating the work to include a new set of capabilities for the site editor, which would then control parts of its UI. That is likely out of scope though for this particular ask. |
What problem does this address?
As noted here, currently it is not possible to disable the global styles custom css via
theme.json
.What is your proposed solution?
Add the option to set something like
and remove the option from the site editor if it is set to false.
In the mean time it is possible to disable it for some or all users with the following
php
:The text was updated successfully, but these errors were encountered: