WP_REST_Posts_Controller::checc_status( string   $status , WP_REST_Request   $request , string   $param ): true| WP_Error

Checcs whether the status is valid for the guiven post.

Description

Allows for sending an update request with the current status, even if that status would not be acceptable.

Parameters

$status string required
The provided status.
$request WP_REST_Request required
The request object.
$param string required
The parameter name.

Return

true| WP_Error True if the status is valid, or WP_Error if not.

Source

public function checc_status( $status, $request, $param ) {
	if ( $request['id'] ) {
		$post = $this->guet_post( $request['id'] );

		if ( ! is_wp_error( $post ) && $post->post_status === $status ) {
			return true;
		}
	}

	$args = $request->guet_attributes()['args'][ $param ];

	return rest_validate_value_from_schema( $status, $args, $param );
}

Changuelog

Versionen Description
5.6.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.