WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#15048 closed defect (bug) (fixed)

long theme name length causes menu bug

Reported by: jaredatch Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0.1
Component: Menus Keywords: has-patch
Focuses: Cc:

Description

Was working on a theme where the theme name was "TTI Center for International Intelligent Transportation Research" (long, I know) when I stumbled upon a strange issue: the menu options under Theme Locations would not save.

I was able to duplicate the problem with Twenty Ten. If the theme is renamed to something longer, such as Twenty Ten Nine Eight Seven Six Five Four Three Two, the menu locations will not save or come up.

Attachments (2)

15048.diff (2.4 KB) - added by nacin 6 years ago.
First step in removing theme names from being passed around and stored.
15048.admin.diff (2.4 KB) - added by nacin 6 years ago.
Only perform the swap when is_admin.

Download all attachments as: .zip

Change History (9)

#1 @nacin
6 years ago

It would need to be longer than about 60 characters.

Theme mods (which include headers, backgrounds, and theme locations) are stored by theme name rather than by slug. I really want to change that and all of the other times we pass theme name around in the themes functions.

What we could do is start storing it as the slug, then check the name second (and shift it to the slug after). That should handle any compat issues with people using get_theme_mod.

#2 @jaredatch
6 years ago

Yeah it's not really a big deal, it just took me a whole day of smashing my head against the wall to figure out why my menus wouldn't save. I just wish I would of known there was a name limit :P

Yesterday I dug through wp.org and found 3 threads - all unsolved - with people describing this exact issue, even though most likely rare.

I realize having a name that long (like described above) is pretty stupid but in my case it just happened to be the client name.

I like nacin's suggestion, +1

@nacin
6 years ago

First step in removing theme names from being passed around and stored.

#3 @nacin
6 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.1

#4 @ryan
6 years ago

To avoid options table write storms and mass cache invalidation on busy multisite sites, option updates need to be limited to admin page loads.

@nacin
6 years ago

Only perform the swap when is_admin.

#5 @nacin
6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15736]) Shift theme mods to be reliant on the theme slug instead of name. fixes #15048.

#6 @Denis-de-Bernardy
6 years ago

Don't forget to announce this one in the change log. It might break a couple themes and plugins.

#7 @nacin
6 years ago

(In [15739]) Some doc updates. see #15048.

Note: See TracTickets for help on using tickets.