#6424 closed defect (bug) (wontfix)
erroneous widget count for sidebars
| Reported by: | Denis-de-Bernardy | Owned by: | |
|---|---|---|---|
| Priority: | lowest | Milestone: | |
| Component: | Plugins | Version: | 2.5 |
| Severity: | trivial | Keywords: | widget |
| Cc: | Focuses: |
Description
activate a plugin that adds new widgets, and insert that widget in a sidebar. You get something like:
"You are using 2 widgets in the "Sidebar" sidebar."
deactivate the plugin. the widget no longer exists. You still get:
"You are using 2 widgets in the "Sidebar" sidebar."
Change History (6)
#4
@
18 years ago
- Component Administration → Plugins
- Keywords widget added; needs-patch removed
- Milestone 2.9
- Resolution → wontfix
- Status new → closed
WordPress widgets are going to get an overhaul in 2.9 and hopefully they would have corrected the cause of this.
The reason for this is that the sidebar widget option is not being updated. Really it could be considered the fault of the plugin author for not removing their widget, but WordPress should also consider sidebars that no longer exist and widgets that no longer exist.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thought I'd throw in an explanation of what's going on since I've been working with widgets lately.
This is happening because that plugin's widget is still technically in the sidebar, but it just doesn't show up because it doesn't exist. Note that if you re-activate the plugin, the widget will be back in your sidebar exactly where you put it rather than on the left side in the unused widgets list. If you hit save which will refresh the sidebar array, the non-existent widget will be removed.
This inaccurate count occurs because that number is just a simple
count($widgets)and done before the widgets are outputted and actually checked to see if they exist.