WC_Email::delete_template_action
Delete template action.
Method of the class: WC_Email{}
Hooks from the method
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->delete_template_action( $template_type );
- $template_type(string) (required)
- Template type.
WC_Email::delete_template_action() WC Email::delete template action code WC 10.7.0
<?php
protected function delete_template_action( $template_type ) {
$template = $this->get_template( $template_type );
if ( $template ) {
if ( ! empty( $template ) ) {
$theme_file = $this->get_theme_template_file( $template );
if ( file_exists( $theme_file ) ) {
unlink( $theme_file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
/**
* Action hook fired after deleting template file.
*
* @param string $template The deleted template type
* @param string $email The email object
*/
do_action( 'woocommerce_delete_email_template', $template_type, $this );
wc_clear_template_cache();
?>
<div class="updated">
<p><?php echo esc_html__( 'Template file deleted from theme.', 'woocommerce' ); ?></p>
</div>
<?php
}
}
}
}