woocommerce_email_content_post_data
Filter the email content post data before creating the post.
Allows third-party integrators to modify the post data (title, content, meta, etc.) before the email content post is created.
Usage
add_filter( 'woocommerce_email_content_post_data', 'wp_kama_woocommerce_email_content_post_data_filter', 10, 3 );
/**
* Function for `woocommerce_email_content_post_data` filter-hook.
*
* @param array $post_data The post data array to be used for wp_insert_post().
* @param string $email_type The email type identifier (e.g., 'customer_processing_order').
* @param \WC_Email $email_data The WooCommerce email object.
*
* @return array
*/
function wp_kama_woocommerce_email_content_post_data_filter( $post_data, $email_type, $email_data ){
// filter...
return $post_data;
}
- $post_data(array)
- The post data array to be used for wp_insert_post().
- $email_type(string)
- The email type identifier (e.g., 'customer_processing_order').
- $email_data(\WC_Email)
- The WooCommerce email object.
Changelog
| Since 10.5.0 | Introduced. |
Where the hook is called
woocommerce_email_content_post_data
woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCTransactionalEmailPostsGenerator.php 291
$post_data = apply_filters( 'woocommerce_email_content_post_data', $post_data, $email_type, $email_data );