How do you remove Divi shortcodes when changing themes?

QuestionsHow do you remove Divi shortcodes when changing themes?
Adam @ WPCrafter Staff asked 2 years ago

Problem with Divi 3 is that all the content is essentially a mesh of shortcodes, so if you ever want to start using something other then Divi Builder, all your content is a huge mess.

How do you remove Divi Builder shortcodes?

1 Answers
Adam @ WPCrafter Staff answered 2 years ago

As you've mentioned, changing themes you've used a page builder with is always going to leave you having to re-design/re-build pages/posts etc.

However, after running into too many conflicts with Divi I had to try this last resort of switching themes… and it's a much nicer process without the shortcode filling your page.

This worked for me without having to use All Export/Import:

I recreated the site locally, installed the new theme (BB & BB Child), activated the child theme and added the following to functions.php

add_filter('the_content', 'remove_divi_shortcodes');
function remove_divi_shortcodes( $content ) {
    $content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
    return $content;

Hopefully, this might work for someone else.

Your Answer
2 + 6 =

Accepted file types: png, jpg, pdf

Add another file