Checks whether the status is valid for the given post.
Description
Allows for sending an update request with the current status, even if that status would not be acceptable.
Parameters
$status
stringrequired- The provided status.
$request
WP_REST_Requestrequired- The request object.
$param
stringrequired- The parameter name.
Source
public function check_status( $status, $request, $param ) {
if ( $request['id'] ) {
$post = $this->get_post( $request['id'] );
if ( ! is_wp_error( $post ) && $post->post_status === $status ) {
return true;
}
}
$args = $request->get_attributes()['args'][ $param ];
return rest_validate_value_from_schema( $status, $args, $param );
}
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.