[wp-trac] [WordPress Trac] #64042: Media / REST API: duplicate records in paginated results when filtering by media_type
WordPress Trac
noreply at wordpress.org
Thu Sep 25 04:36:04 UTC 2025
#64042: Media / REST API: duplicate records in paginated results when filtering by
media_type
--------------------------+-----------------------------
Reporter: ramonopoly | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: rest-api |
--------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64042>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list