protected function handle_status_param( $post_status, $post_type ) {

		switch ( $post_status ) {
			case 'draft':
			case 'pending':
				break;
			case 'private':
				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
					return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to create private posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
				}
				break;
			case 'publish':
			case 'future':
				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
					return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to publish posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
				}
				break;
			default:
				if ( ! get_post_status_object( $post_status ) ) {
					$post_status = 'draft';
				}
				break;
		}

		return $post_status;
	}
protected function handle_status_param( $post_status, $post_type ) {

		switch ( $post_status ) {
			case 'draft':
			case 'pending':
				break;
			case 'private':
				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
					return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to create private posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
				}
				break;
			case 'publish':
			case 'future':
				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
					return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to publish posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
				}
				break;
			default:
				if ( ! get_post_status_object( $post_status ) ) {
					$post_status = 'draft';
				}
				break;
		}

		return $post_status;
	}
protected function handle_status_param ( $ post_status , $ post_type ) { switch ( $ post_status ) { case 'draft' : case 'pending' : break ; case 'private' : if ( ! current_user_can ( $ post_type -> cap -> publish_posts ) ) { return new WP_Error ( 'rest_cannot_publish' , __ ( 'Sorry, you are not allowed to create private posts in this post type.' ) , array ( 'status' => rest_authorization_required_code ( ) ) ) ; } break ; case 'publish' : case 'future' : if ( ! current_user_can ( $ post_type -> cap -> publish_posts ) ) { return new WP_Error ( 'rest_cannot_publish' , __ ( 'Sorry, you are not allowed to publish posts in this post type.' ) , array ( 'status' => rest_authorization_required_code ( ) ) ) ; } break ; default : if ( ! get_post_status_object ( $ post_status ) ) { $ post_status = 'draft' ; } break ; } return $ post_status ; }
Determine validity and normalize provided status param.

@param string $post_status Post status.
@param object $post_type   Post type.
@return WP_Error|string $post_status
Determine validity and normalize provided status param .