Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#53305 closed defect (bug) (fixed)

REST API: Duplicate widget types in /wp/v2/widget-types

Reported by: noisysocks's profile noisysocks Owned by: timothyblynjacobs's profile TimothyBlynJacobs
Milestone: 5.8 Priority: normal
Severity: normal Version: 5.8
Component: REST API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description (last modified by noisysocks)

The /wp/v2/widget-types endpoint is returning duplicate widget types which causes the issue described in


$ http -a admin:password GET http://wp-git-build.test/wp-json/wp/v2/widget-types | jq '.[].id'

Change History (5)

#1 @noisysocks
3 years ago

  • Description modified (diff)

This ticket was mentioned in PR #1317 on WordPress/wordpress-develop by noisysocks.

3 years ago

  • Keywords has-patch has-unit-tests added

Modifies the /wp/v2/widget-types endpoint to de-duplicate widget types by their id. Duplicates appear because WP_Widget::_register will add one entry to $wp_registered_widgets per widget instance.

Trac ticket:

#3 @SergeyBiryukov
3 years ago

#53302 was marked as a duplicate.

#4 @spacedmonkey
3 years ago

I also had a ticket for this at #53302

Also related #53303

Now that the widgets array has key, we could ksort to make sure widget types are in an alphabetical order.

#5 @TimothyBlynJacobs
3 years ago

  • Owner set to TimothyBlynJacobs
  • Resolution set to fixed
  • Status changed from new to closed

In 51049:

REST API: Remove duplicates in the widget types endpoint.

Props noisysocks, spacedmonkey, imath, isabel_brison.
Fixes #53305.

Note: See TracTickets for help on using tickets.