Opened 20 months ago
Last modified 16 months ago
#58710 new defect (bug)
REST: media (images) deleted or replaced are returned by their new id when requested by their old id
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | 6.2.2 |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
An article has got a featured image assigned (id X).
The featured image is replaced* using Media library (id Y).
REST API for article delivers old image id (X).
Upon requesting fields (id, src) for old image id (X) from REST API media endpoint, the field id returned is the new image id (Y).
I expect the requested id and the returned id to match.
Alternatively I like to be able to get to know which id returned correlates to which id requested.
Example: https://deananddavid.com/wp-json/wp/v2/media/?include=77793&_fields=id,source_url&per_page=100
"include" as per documentation requests certain ids. Notice the returned id is 77795 (5 instead 3 at last digit).
'* the replacement was done by an editor. I don't know the exact procedure she/he took.
We just stumbled upon a similar problem -- which might be related or a bugfix to the one described in the op:
91 images are requested by id like in the op (comma-seperated) but only 86 entries are returned although the images requested are present in WordPress by the id they are requested with.
I have no further info currently about how the images were uploaded into WordPress.
a mitigating factor might be the new/missing image was uploaded to a different post, it apparently is selectable as a featured image in Admin but REST did not return it.