Skip to content

Instantly share code, notes, and snippets.

@jfarsen
Created August 9, 2017 01:37
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jfarsen/beab40491848dc161436eaa6a86b95f2 to your computer and use it in GitHub Desktop.
Save jfarsen/beab40491848dc161436eaa6a86b95f2 to your computer and use it in GitHub Desktop.
Remove Divi shortcodes from content
<?php
/**
* Remove Divi shortcodes from content
*
* @see http://victorfont.com/remove-divi-shortcodes-changing-themes/
*/
function remove_divi_shortcodes( $content ) {
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
return $content;
}
@mohamdio
Copy link

What about this new plugin ( Shortcode Cleaner )
https://plugins.jozoor.com/shortcode-cleaner/
video demo: https://www.youtube.com/watch?v=dXVZ5bSUduc
It easily removes Divi shortcodes automatically when changing it to a new theme.
It removes unused, broken shortcodes from WordPress, so you can switch between themes and plugins without worrying and keep your content cleanly and fresh all the time, it is dealing with any theme (Divi, Avada, ..etc) shortcodes that are left when changing themes or plugins.

I think it will be useful for any site.

@rmdes
Copy link

rmdes commented Sep 17, 2019

This plugins works really well. best solutions so far to move away from Divi/Avada etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment