Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Created February 8, 2021 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zodiac1978/a80c47d253109df30952bef045385280 to your computer and use it in GitHub Desktop.
Save Zodiac1978/a80c47d253109df30952bef045385280 to your computer and use it in GitHub Desktop.
Remove divi shortcodes from attached pages in Germanized for Woocommerce plugin mails
<?php
/**
* Just return the content
*
* @param [string] $atts Unused attributes.
* @param [string] $content Submitted content.
* @return [string] Unmodified content with shortcodes because of nested shortcodes.
*/
function divi_remove_shortcodes( $atts, $content ) {
return do_shortcode( $content );
}
/**
* Unregisters divi shortcodes and re-adds with only content.
*/
function my_child_remove_custom_shortcodes() {
remove_shortcode( 'et_pb_section' );
remove_shortcode( 'et_pb_row' );
remove_shortcode( 'et_pb_column' );
remove_shortcode( 'et_pb_text' );
add_shortcode( 'et_pb_section', 'divi_remove_shortcodes' );
add_shortcode( 'et_pb_row', 'divi_remove_shortcodes' );
add_shortcode( 'et_pb_column', 'divi_remove_shortcodes' );
add_shortcode( 'et_pb_text', 'divi_remove_shortcodes' );
}
add_action( 'woocommerce_germanized_attach_email_footer', 'my_child_remove_custom_shortcodes', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment