Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCTransactionalEmailPostsManager::get_email_postpublicWC 1.0

Retrieves the email post by its type.

Type here refers to the email type, e.g. 'customer_new_account' from the WC_Email->id property.

Method of the class: WCTransactionalEmailPostsManager{}

No Hooks.

Returns

\WP_Post|null. The email post if found, null otherwise.

Usage

$WCTransactionalEmailPostsManager = new WCTransactionalEmailPostsManager();
$WCTransactionalEmailPostsManager->get_email_post( $email_type );
$email_type(string) (required)
The type of email to retrieve.

WCTransactionalEmailPostsManager::get_email_post() code WC 10.3.6

public function get_email_post( $email_type ) {
	$post_id = $this->get_email_template_post_id( $email_type );

	if ( ! $post_id ) {
		return null;
	}

	$post = get_post( $post_id );

	if ( ! $post instanceof \WP_Post ) {
		return null;
	}

	return $post;
}