Opened 9 years ago
Last modified 5 years ago
#33602 assigned defect (bug)
is_active_sidebar returns true when widget has been deactivated
Reported by: | karlikdesign | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3 |
Component: | Widgets | Keywords: | reporter-feedback |
Focuses: | administration | Cc: |
Description
When I activate a plugin (in this case Ultimate Social Media and Share icons)
Add the widget to my sidebar area
Deactivate the plugin
The widget is no longer visible in the sidebar
BUT
is_active_sidebar still returns true
Attachments (1)
Change History (7)
#2
follow-up:
↓ 3
@
9 years ago
Can is_active_sidebar()
scan through all the widgets and check is every registered widget is actually not deactivated?
If not realistic, this a wontfix, even if it may seem unexpected behaviour. A note could be added to the docs.
#3
in reply to:
↑ 2
@
9 years ago
- Keywords close 2nd-opinion removed
- Owner set to welcher
- Status changed from new to assigned
Replying to knutsp:
Can
is_active_sidebar()
scan through all the widgets and check is every registered widget is actually not deactivated?
If not realistic, this a wontfix, even if it may seem unexpected behaviour. A note could be added to the docs.
It's possible to look at the contents of $wp_registered_widgets
to see if the instances stored in sidebars_widgets
are in there. I was able to address the issue by using the is_active_sidebar
filter with this -[ https://gist.github.com/ryanwelcher/64042dc1946f36840b61]
I'll work it into a patch shortly.
I believe this is due to how the widgets are stored. Adding a widget to a sidebar and then deactivating the plugin that generates the widget doesn't purge the widget instance from the sidebars_widgets option - to my knowledge anyway - and that is essentially what is driving whether or not a sidebar is considered active.