protected function do_save( \WP_Post $post ) {

		if ( ! $post->ID ) {
			$id = wp_insert_post( wp_slash( $post->to_array() ), true );
		} else {
			$id = wp_update_post( $post, true );
		}

		if ( is_wp_error( $id ) ) {
			throw new \InvalidArgumentException( 'Error encountered while saving WP_Post: ' . $id->get_error_message() );
		}

		return get_post( $id );
	}
protected function do_save( \WP_Post $post ) {

		if ( ! $post->ID ) {
			$id = wp_insert_post( wp_slash( $post->to_array() ), true );
		} else {
			$id = wp_update_post( $post, true );
		}

		if ( is_wp_error( $id ) ) {
			throw new \InvalidArgumentException( 'Error encountered while saving WP_Post: ' . $id->get_error_message() );
		}

		return get_post( $id );
	}
protected function do_save ( \ WP_Post $ post ) { if ( ! $ post -> ID ) { $ id = wp_insert_post ( wp_slash ( $ post -> to_array ( ) ) , true ) ; } else { $ id = wp_update_post ( $ post , true ) ; } if ( is_wp_error ( $ id ) ) { throw new \ InvalidArgumentException ( 'Error encountered while saving WP_Post: ' . $ id -> get_error_message ( ) ) ; } return get_post ( $ id ) ; }
Do the saving for a post.

@since 2.0

@param \WP_Post $post

@return \WP_Post
Do the saving for a post .