WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 9 months ago

#39167 new enhancement

Theme mods should be able to be gotten/changed on inactive themes.

Reported by: georgestephanis Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.1
Component: Themes Keywords: has-patch 2nd-opinion
Focuses: Cc:
PR Number:

Description

Currently, there is no way (short of direct option queries) to get theme mods of an inactive theme. This can be problematic when a user wants to see what changes they had configured on a parent theme, when on a child theme, or when trying to see the other theme mods they had configured elsewhere.

This change moves the bulk of the theme mod functions to be methods on the WP_Theme class -- so if you wp_get_theme() any theme -- active or inactive -- you can view and change its mods.

The attached changeset also converts the existing legacy methods to use the new versions on the current theme.

Related: [4401]

Attachments (1)

theme_mods_multi_theme.diff (7.5 KB) - added by georgestephanis 3 years ago.

Download all attachments as: .zip

Change History (2)

#1 @obenland
3 years ago

I like it. We could probably even remove the _theme part in the method names. It would be interesting to know what the performance impact looks like.

Note: See TracTickets for help on using tickets.