Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created May 27, 2024 12:14
Show Gist options
  • Save webtoffee-git/843bd1596c5d5536e5c27d577d038381 to your computer and use it in GitHub Desktop.
Save webtoffee-git/843bd1596c5d5536e5c27d577d038381 to your computer and use it in GitHub Desktop.
Add custom shortcodes to Wordpress emails - By WebToffee( Decorator – WooCommerce email customizer )
<?php //Do not copy this line of code
add_filter('wt_woomail_no_order_body_text','wbtf_add_custom_placeholder_to_user_emails',10,2);
function wbtf_add_custom_placeholder_to_user_emails($body_text, $email) {
if ( is_a( $email->object, 'WP_User' ) ) {
$body_text = str_replace( '{custom_value}', 'Actual data to replace', $body_text ); // Replace placeholder and value here
}
return $body_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment