Make WordPress Core

Opened 7 weeks ago

Closed 7 weeks ago

Last modified 7 weeks ago

#64042 closed defect (bug) (invalid)

Media / REST API: duplicate records in paginated results when filtering by media_type

Reported by: ramonopoly's profile ramonopoly Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: rest-api Cc:

Description

In the attachments REST API endpoint, the endpoint returns the same attachment record over subsequent pages when filtering by media_type.

For example, given 25 attachment posts, the first request will return 20 records:

/wp-json/wp/v2/media?context=view&per_page=20&page=1&media_type=image

like so:

[ ...records, { id: 18, ...fields } ]

the request for the second page,

/wp-json/wp/v2/media?context=view&per_page=20&page=2&media_type=image

returns the remaining five

[ ...records, { id: 18, ...fields }, ...records ]

It appears to be true regardless of the per_page value or how many records exist.

Change History (4)

#1 @ramonopoly
7 weeks ago

Actually, I can't reproduce any more on WordPress trunk :-)

I'll test again and close this ticket if I've taken a wrong turn somewhere.

#2 @ramonopoly
7 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

#3 @ramonopoly
7 weeks ago

I actually think the cause of the bug is related to #40376

Last edited 7 weeks ago by ramonopoly (previous) (diff)

#4 @ramonopoly
7 weeks ago

See also #47642 and #44349

Note: See TracTickets for help on using tickets.