[wp-trac] [WordPress Trac] #40399: Post Status Inherited not Supported with REST API
WordPress Trac
noreply at wordpress.org
Thu Aug 22 18:49:30 UTC 2019
#40399: Post Status Inherited not Supported with REST API
--------------------------+-----------------------------
Reporter: dfenton | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 4.7.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+-----------------------------
Changes (by kadamwhite):
* milestone: Awaiting Review => Future Release
Old description:
> I'm trying to use the REST API to update a post_meta field on an an image
> of post_type="attachment", which is itself attached to an existing post
> of post_type="post" that is published and password protected.
>
> Since the image is an attachment that is attached to another post,
> WordPress has set the post_status of the attachment to "inherit".
>
> When I try to update the attachment from the REST API endpoint I'm
> getting the following error:
>
> {{{
> Uncaught Error: Syntax error, unrecognized expression:
> {"code":"rest_invalid_param","message":"Invalid parameter(s):
> status","data":{"status":400,"params":{"status":"status is not one of
> publish, future, draft, pending, private."}}}
> }}}
>
> It's clear in the documentation that post_status="inherit" isn't
> supported by the REST API for Media endpoints but I'm not sure if this is
> a bug or merely an oversight. My feeling is that since Wordpress supports
> and sets attachments to "inherit" as a post_status, that the API should
> accept that, particularly when it's perfectly happy to deliver that
> status to me on a GET request.
New description:
I'm trying to use the REST API to update a post_meta field on an an image
of post_type="attachment", which is itself attached to an existing post of
post_type="post" that is published and password protected.
Since the image is an attachment that is attached to another post,
WordPress has set the post_status of the attachment to "inherit".
When I try to update the attachment from the REST API endpoint I'm getting
the following error:
{{{
Uncaught Error: Syntax error, unrecognized expression:
{"code":"rest_invalid_param","message":"Invalid parameter(s):
status","data":{"status":400,"params":{"status":"status is not one of
publish, future, draft, pending, private."}}}
}}}
It's clear in the documentation that post_status="inherit" isn't supported
by the REST API for Media endpoints but I'm not sure if this is a bug or
merely an oversight. My feeling is that since WordPress supports and sets
attachments to "inherit" as a post_status, that the API should accept
that, particularly when it's perfectly happy to deliver that status to me
on a GET request.
--
Comment:
> You should absolutely be able to PUT back the response from a GET
request.
Agreed; assigning to Future Release, if anybody's keen to own this one
it'd be a good thing to sort out in the next couple releases.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40399#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list