wp/wp-includes/rest-api/class-wp-rest-response.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   225 	public function as_error() {
   225 	public function as_error() {
   226 		if ( ! $this->is_error() ) {
   226 		if ( ! $this->is_error() ) {
   227 			return null;
   227 			return null;
   228 		}
   228 		}
   229 
   229 
   230 		$error = new WP_Error;
   230 		$error = new WP_Error();
   231 
   231 
   232 		if ( is_array( $this->get_data() ) ) {
   232 		if ( is_array( $this->get_data() ) ) {
   233 			$data = $this->get_data();
   233 			$data = $this->get_data();
   234 			$error->add( $data['code'], $data['message'], $data['data'] );
   234 			$error->add( $data['code'], $data['message'], $data['data'] );
   235 
   235