How to remove all Divi shortcodes when changing themes

I will not tire of repeating how good the Divi theme is and recommending it, because it is one of the best WordPress themes out there to create conversion, home, landing pages and all that web that you want to layout in an impressive way.

The "lock-in" effect

Now, there comes a day when you decide, for whatever reason, to change the theme on the web that you used to have 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, shortcuts or whatever, that when you want to change to another, they leave a trace of them.

And Divi is no exception.

The option to create new pages

After disabling Divi, to avoid the horror of the screenshot above, you could edit the page and erase all traces of shortcodes by hand, 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 the subject is not to try to erase the trace of the previous one, but simply to make new pages, already with the new subject, and discard the previous ones.

This, although it may seem crazy to you, is sometimes the best option, because you don't waste any time deleting or destroying, you focus on creating.

If you only had a few pages designed with Divi, and you were going to have to redesign them with the new theme or layout anyway, 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 make a redirect from the old to the new, whichever you prefer.

Always analyze the effort-results ratio before making any decisions, and sometimes this option will simply be the best.

Remove all Divi shortcodes with one simple function

Another very different situation is when you have used the Divi layout maker to include rich content on all types 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 these types of situations, it is best to cut your losses, as a surgeon would say, to avoid all traces.

And the best and fastest thing is to use a function that, at once, erases all traces of Divi shortcodes.

add_filter('the_content', 'clasesordenador_quitar_shortcodes_divi');

function clasesordenador_quitar_shortcodes_divi( $content ) {

$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);

return $content;

}

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, but the world)

In your customizations plugin or mu plugin.

Just add it, save the changes and all traces of Divi shortcodes will be erased.

What the code does is 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 get it is Shortcode Cleaner Lite.

As soon as you activate it, the plugin automatically deactivates all orphaned shortcodes it finds, including those from Divi.

But don't 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 completely delete them from the database you need the pro version of the plugin.

So it is a free plugin that, rather than removing shortcodes from plugins and themes that you no longer use, deactivates them while you have the plugin active.

If what you want is to delete all orphaned shortcodes permanently from inactive plugins and themes, you will have to purchase the pro version, and then it will be an activate, delete and deactivate plugin once you finish.

In any case, it is a very interesting option that, in addition, not only cleans your website of Divi shortcodes, but also lots of other themes and plugins that you no longer use and have left shortcodes in your content.

Now, if you prefer a plugin that easily deletes all Divi shortcodes, and saves you hundreds of hours of revision, or having to touch code, you have "Goodbye Divi".

With this plugin you can do a previous test, to check what will happen, and then clean all Divi shortcodes.

Date update on 2021-02-16. Date published on 2021-02-16. Category: Computer class Author: Oscar olg Fuente: ayudawp