Opened 3 years ago
Closed 3 years ago
#53612 closed defect (bug) (fixed)
Widgets not loaded after deleting multiple widgets at once
Reported by: | walbo | Owned by: | TimothyBlynJacobs |
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Widgets | Keywords: | has-patch has-unit-tests fixed-major commit dev-reviewed |
Focuses: | rest-api | Cc: |
Description
When deleting multiple widgets at once, no widgets is loaded in the editor. The widgets I didn't delete do show in the customizer widget sceen and frontend.
It doesn't happend if you delete the last widgets, only if you delete from the beginning or in the middle of the array.
Steps to reproduce:
- Create a few widgets in an area and save. (or from a fresh dev install you already have them)
- Select the 2 first widgets and delete them. Then save.
- Reload the widget editor and no widgets in loaded.
Attachments (1)
Change History (16)
#4
follow-up:
↓ 7
@
3 years ago
Looks like we need an array_values
call when preparing the widgets
property.
This ticket was mentioned in PR #1480 on WordPress/wordpress-develop by walbo.
3 years ago
#6
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/53612
#7
in reply to:
↑ 4
@
3 years ago
Replying to TimothyBlynJacobs:
Looks like we need an
array_values
call when preparing thewidgets
property.
Yes. Adding array_values
brings them back.
I can't find a good explanation why it only happens when deleting multiple widgets and not just one.
#8
@
3 years ago
- Keywords needs-unit-tests added
Can we get a unit test or two in place for this as well?
#9
@
3 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
Added a unit test to the PR.
TimothyBJacobs commented on PR #1480:
3 years ago
#10
This looks great, thanks for working on it @walbo! Will commit shortly.
#12
@
3 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport.
Before deleting the sidebars rest-api return an array:
After save its a object: