woocommerce_email_editor_send_preview_email_subject filter-hookWC 2.9.0

Filters the subject of the preview email before it is sent or rendered.

Usage

add_filter( 'woocommerce_email_editor_send_preview_email_subject', 'wp_kama_woocommerce_email_editor_send_preview_subject_filter', 10, 2 );

/**
 * Function for `woocommerce_email_editor_send_preview_email_subject` filter-hook.
 * 
 * @param string   $subject The email subject.
 * @param \WP_Post $post    The email post object.
 *
 * @return string
 */
function wp_kama_woocommerce_email_editor_send_preview_subject_filter( $subject, $post ){

	// filter...
	return $subject;
}
$subject(string)
The email subject.
Default: post title
$post(\WP_Post)
The email post object.

Changelog

Since 2.9.0 Introduced.

Where the hook is called

Send_Preview_Email::get_preview_email_subject()
woocommerce_email_editor_send_preview_email_subject
woocommerce/packages/email-editor/src/Engine/class-send-preview-email.php 122
$subject = (string) apply_filters( 'woocommerce_email_editor_send_preview_email_subject', $post->post_title, $post );

Where the hook is used in WooCommerce

woocommerce/src/Internal/EmailEditor/Integration.php 146
add_filter( 'woocommerce_email_editor_send_preview_email_subject', array( $this, 'update_email_subject_for_send_preview_email' ), 10, 2 );