Skip to content

media API Accessibility Dependent on Parent Post Status for Initially Uploaded Media #206

@naokiuma

Description

@naokiuma

Hi.
I kindly ask you to consider this.

■Problem Description

When media (e.g., an image) is first uploaded directly within a post's editing screen, that post becomes the media item's parent. If this parent post is then set to a private status (or deleted), the media item itself also becomes inaccessible via the media REST API endpoint.

https://example.com/wp-json/wp/v2/media

This behavior was observed and verified through testing.

This creates an unexpected dependency where media accessibility through the API is tied to the privacy status of its initial parent post, even if that media is later used in other public posts. This can lead to broken media links or inaccessible assets when consuming media via the API.

■Expected Behavior

Media uploaded to WordPress should remain accessible via the /media REST API endpoint regardless of the privacy status of the post it was initially uploaded through. Its accessibility should ideally be determined by its own status or its usage in publicly accessible content, rather than being strictly tied to a single "parent" post's private status if that parent is merely the point of initial upload.

■Proposed Solution / Workaround

It is suggested that this behavior be documented on pages like https://developer.wordpress.org/rest-api/reference/media/ as a note of caution regarding the accessibility of media items, especially those initially uploaded within a post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions