MailPoet\EmailEditor\Engine

Send_Preview_Email::fetch_post()privateWC 1.0

Fetches a post_id post object based on the provided post ID.

Method of the class: Send_Preview_Email{}

No Hooks.

Return

\WP_Post. The WordPress post object.

Usage

// private - for code of main (parent) class only
$result = $this->fetch_post( $post_id ): \WP_Post;
$post_id(int) (required)
The ID of the post to fetch.

Send_Preview_Email::fetch_post() code WC 9.8.1

private function fetch_post( $post_id ): \WP_Post {
	$post = get_post( intval( $post_id ) );
	if ( ! $post instanceof \WP_Post ) {
		throw new \Exception( esc_html__( 'Invalid post', 'woocommerce' ) );
	}
	return $post;
}