Opened 3 years ago
Closed 2 years ago
#14828 closed enhancement (fixed)
Database query for non-existent mods_themename option
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Performance | Version: | 3.1 |
| Severity: | normal | Keywords: | needs-refresh commit |
| Cc: |
Description
I have noticed this in Twenty Ten and in a couple of other themes, but I imagine it must be the same for any theme for which the mods_themename option applies:
Unless you have visited one of the Menus, Background, etc. screens, and have modified something there, the mods_themename option is not added to the DB. As a result, WordPress does not find it in the autoloaded set and has to query the DB.
Attachments (1)
Change History (12)
- Keywords needs-patch added
Can we try to resolve this by freeze (a few days from now)? Will also ping Ian Stewart and see if he can weigh in.
- Keywords has-patch added; needs-patch removed
We had decided to avoid messing with switch_theme() in #15048, but to avoid the extra query, here's an attempt.
comment:7
iandstewart — 3 years ago
Looks good to me.
- Milestone changed from 3.1 to Future Release
This is going to do an add_option on a front-page load.
We try and avoid those.
Moving out of 3.1 to Future Release
comment:9
markjaquith — 2 years ago
- Milestone changed from Future Release to 3.1
For later:
if ( is_admin() )
add_option( "theme_mods_" . $stylesheet, (array) get_option( "mods_" . $theme ) );
comment:10
nacin — 2 years ago
- Keywords needs-refresh commit added; has-patch removed
comment:11
nacin — 2 years ago
- Resolution set to fixed
- Status changed from accepted to closed

Let's try to add it when a theme gets activated.