WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9770 closed defect (bug) (invalid)

dynamic_sidebar() should not save widgets on theme preview

Reported by: 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 5 years ago.
better patch

Download all attachments as: .zip

Change History (8)

comment:1 Denis-de-Bernardy5 years ago

  • Keywords dev-feedback added

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

comment:2 Denis-de-Bernardy5 years ago

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

Denis-de-Bernardy5 years ago

better patch

comment:3 in reply to: ↑ description azaozz5 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).

comment:4 Denis-de-Bernardy5 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.

comment:5 Denis-de-Bernardy5 years ago

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

comment:6 Denis-de-Bernardy5 years ago

  • Milestone 2.8 deleted

comment:7 azaozz5 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.