-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
How to persist user data across theme switches? #47420
Comments
theme.json
algorithmtheme.json
algorithm to persist user data across theme switches
I don't consider this being or requiring a new layer definition. This fits precisely in the "user" layer, from my perspective, it's just not coupled to a specific theme namespace. |
Right, that's true. Not sure about what name to use other than layer. The important thing for me is that presets for the theme dependent data ( |
theme.json
algorithm to persist user data across theme switches
Shouldn't we be consistent here, meaning if we removing the coupling for global styles, we should also remove it for the templates and template parts. |
I've got a question, let me know your thoughts. My first instinct is that no, this data shouldn't be used if the theme does not have a |
More braindump. For the first bits we want to implement (font manager or making the color palette theme independent) the UI flows will tell us where to store the data:
It seems the concept of theme-dependent or theme-independent styles needs to be managed at the UI level, for the user to declare their intent. At the infrastructure level, as long as we have two posts/data sources we can tell apart ( |
The existing post that holds The new post to hold
I like the simplicity of 1.1. Thinking of how to reuse a similar mechanism to templates & template_parts:
Any of the approaches could be reused for templates/template parts. |
@matiasbenedetto started working on this at #50102 |
There's a change of direction after this conversation #50102 (comment) Riad suggested exploring a different path. I'm going to close this for now to signal this is no longer "to be implemented". The conversation is documented anyway, we can always reopen. |
What
In working on a few features such as:
There's been a common thread among them all: how the user data they represent should persist across a theme switch.
Why
By considering these use cases together, we can suggest a solution that address all of these issues at once, and paves the way for future customizations.
How
The current theme.json algorithm considers the following origins of data:
default
, data coming from WordPressblocks
, data coming from the blocks themselvestheme
, data coming from the active themecustom
, data coming from the user for the active themeThe suggestion would be to create a new origin of data (name to be determined, but I'll run with
site
here), to be loaded later thancustom
, thereby its priority would be higher than any other layer. Bothcustom
andsite
come from the user, thoughcustom
is theme dependent andsite
is theme independent.The
site
data would be stored as awp_global_styles
CPT likecustom
is.Questions
custom
aka theme dependent (cleared upon theme switch) orsite
aka theme independent (wouldn't be cleared upon theme switch)?custom
data and the post that holdssite
data?The text was updated successfully, but these errors were encountered: