Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#9770 closed defect (bug) (invalid)

dynamic_sidebar() should not save widgets on theme preview

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.8
Component: Widgets Keywords: has-patch dev-feedback
Focuses: Cc:

Description

when looking a theme that adds widgets and sidebars, dynamic_sidebar() calls currently save the sidebars_widgets option.

this should not happen.

Attachments (1)

9770.diff (512 bytes) - added by Denis-de-Bernardy 15 years ago.
better patch

Download all attachments as: .zip

Change History (8)

#1 @Denis-de-Bernardy
15 years ago

  • Keywords dev-feedback added

the test could also be a straight false, or !is_admin()...

#2 @Denis-de-Bernardy
15 years ago

mm, that is_preview() actually is for post previews. so the call is erroneous.

@Denis-de-Bernardy
15 years ago

better patch

#3 in reply to: ↑ description @azaozz
15 years ago

Replying to Denis-de-Bernardy:

when looking a theme that adds widgets and sidebars, dynamic_sidebar() calls currently save the sidebars_widgets option.

The option is updated only when $sidebars_widgets['array_version'] = 3 is not set and is_admin() is true. This is a test if the data in the array is in old format which only happens when upgrading WordPress from 2.3 (I think).

#4 @Denis-de-Bernardy
15 years ago

Actually, it's:

wp_get_sidebars_widgets($update = true)

And the update occurs if $update is true and is_admin(), rather than if the array_version is not 3 and is_admin(). But agreed, it's a rather minor.

#5 @Denis-de-Bernardy
15 years ago

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

#6 @Denis-de-Bernardy
15 years ago

  • Milestone 2.8 deleted

#7 @azaozz
15 years ago

There's a switch() in wp_get_sidebars_widgets() that doesn't match when the array_version is set to 3. Can add this but don't think it will have any impact, as you say it's minor.

Note: See TracTickets for help on using tickets.