Skip to content

Media API displays deleted media #72274

Open

Description

Quick summary

User in 5833237-zen reported that, after creating a post via the API, and uploading media, he deleted the media via WP admin. After deletion, the media is still retrievable via Media API.

Steps to reproduce

  1. I have created post with id:123 and have uploaded a media to it.

  2. In the media API (GET /wp/v2/media/) I will get "post" : 123 (i.e Id of post) which is the media's parent.

  3. Then I deleted the media from the post 123 from WordPress UI, but still when I hit the media API

  4. I am getting "post" : 123 (i.e Id of post). That means the parent mapping with media which has removed from the post still exist

What you expected to happen

If the attachment is removed from the post, you should not get the id of that post when requesting the attachment.

What actually happened

If the attachment is removed from the post, you do get the id of that post when requesting the attachment.

Context

p3hLNG-1cG-p2

Platform (Simple, Atomic, or both?)

Atomic, Self-hosted

Theme-specific issue?

No response

Browser, operating system and other notes

No response

Reproducibility

Consistent

Severity

None

Available workarounds?

None

Workaround details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    APITriagedTo be used when issues have been triaged.User ReportThis issue was created following a WordPress customer report[Feature] MediaThe media screen in Calypso, general media management, or integration with third party media.[Platform] Atomic[Platform] Simple[Pri] Low[Type] Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions