Automattic\WooCommerce\Internal\EmailEditor
Integration::delete_email_template_associated_with_email_editor_post
Delete the email template associated with the email editor post when the post is permanently deleted.
Method of the class: Integration{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Integration = new Integration(); $Integration->delete_email_template_associated_with_email_editor_post( $post_id, $post );
- $post_id(int) (required)
- The post ID.
- $post(WP_Post) (required)
- The post object.
Integration::delete_email_template_associated_with_email_editor_post() Integration::delete email template associated with email editor post code WC 10.3.6
public function delete_email_template_associated_with_email_editor_post( $post_id, $post ) {
if ( self::EMAIL_POST_TYPE !== $post->post_type ) {
return;
}
$post_manager = WCTransactionalEmailPostsManager::get_instance();
$email_type = $post_manager->get_email_type_from_post_id( $post_id );
if ( empty( $email_type ) ) {
return;
}
$post_manager->delete_email_template( $email_type );
}