I cant get tired of saying how good the Divi theme is, because it is one of the best WordPress themes out there to create conversion pages, home, landing and all that web you want to layout in a stunning way.
The “lock-in” effect
Now, there comes a day when you decide, for whatever reason, to change the theme on the website you had before Divi, and there is a small problem: the terrible lock-in effect of all themes.
What is this lock-in effect?
Well, the fact that every theme, plugin or even WordPress, has its own codes, shortcodes, shortcodes, shortcodes or whatever, that when you want to switch to another, they leave traces of them.
And Divi is no exception.
A page created with Divi, if it is active, can look this fantastic…

But if you deactivate the theme or the Divi layout to change the theme, the page will look like this…

It is clear that this page has become useless, what do we do?
The option to create new pages
After deactivating Divi, to avoid the horror of the previous capture, you could edit the page and delete by hand all traces of shortcodes, but this can be a huge task if you used Divi for many pages, products, or whatever.
Now, there are situations in which the easiest thing to do when changing theme is not to try to erase the trace of the previous one, but simply make new pages, already with the new theme, and discard the previous ones.
This, although it may seem crazy sometimes is the best option, because you do not waste any time deleting or destroying, you focus on creating.
If you only had designed a few pages with Divi, and anyway you were going to have to design them again with the new theme or layout, focus on that, create the new pages.
When you have them simply replace the old ones with the new ones, or delete the old ones, or do a redirect from the old ones to the new ones, whatever you prefer.
Always analyze the effort-to-results ratio before making any decision, and sometimes this option will simply be the best one.
Remove all Divi shortcodes with one simple function
Another very different situation is when you have used the Divi layout to include rich content in all kinds of pages, posts, products, etc..
In this case it would be terrible to have to go around creating each new content, or manually deleting all traces of shortcodes.
In this type of situation, the best thing to do is to end it all, to avoid all traces.
And the best and fastest is to use a function that, at once, erases all traces of Divi shortcodes.
I refer to this one:
/* Remove Divi shortcodes (wphelp.blog) */
add_filter('the_content', 'wphelp_remove_shortcodes_divi');
function wphelp_remove_shortcodes_divi( $content ) {
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
return $content;
}
Code language: PHP (php)
This code works if you add it:
- At the end of the functions.php file of the active theme (which will not be Divi, because it is assumed that you have already deactivated it, otherwise you mess up the world).
- In your customizations plugin or mu plugin.
You just have to add it, save the changes and all traces of Divi shortcodes will be deleted.
What the code does is to disable all Divi shortcodes of the content of posts, pages, products, etc..
Remove all Divi shortcodes with plugins
The other possibility to remove all traces of Divi is to use plugins.
And the most popular plugin to achieve this is Shortcode Cleaner Lite.
As soon as you activate it, the plugin automatically deactivates all the orphaned shortcodes it finds, including those from Divi.

But do not worry, it is not irreversible, because the free version of the plugin only deactivates them while the plugin is active, if you deactivate the plugin they are still there.
To delete them completely from the database you need the pro version of the plugin.
So it is a free plugin that, rather than delete the shortcodes of plugins and themes that you no longer use, it deactivates them while the plugin is active.
If what you want is to delete all orphaned shortcodes definitely inactive plugins and themes you will have to purchase the pro version, and then it will be a plugin to activate, delete what you want and deactivate it once you’re done.
In any case it is a very interesting option that not only cleans your website from Divi shortcodes, but also from lots of other themes and plugins that you no longer use and have left shortcodes in your content.

You’re missing an important step to actually remove Divi shortcuts. First, the code needs to remove the WordPress shortcodes then second, remove the Divi shortcodes. Place the 1st code in functions.php (at the very bottom), Save and then refresh the site. Make sure to have the theme defaulted to a basic WP theme such as Twenty Twenty-One. Then add the 2nd functions to remove Divi shortcodes. Place at the bottom under the 1st function, Save and refresh the site.
No.1
No.2
Thank You for the code shared 🙂
how to remove from database too without plugin