I am exporting wordpress blog posts from one website and importing them to another wordpress website. Unfortunately, the blog posts are including page builder created shortcodes from the old website. I need to figure out how to either exclude the shortcodes while exporting the posts or removing the shortcodes while importing them to the new site.

The old website is fairly unstable.

  • do you have examples? How are you performing your export and import? What is the page builder?
    – Tom J Nowell
    Commented Jul 8, 2023 at 0:07
  • @TomJNowell the builder is WPBakery Page Builder. The Parent Theme is Salient. I am using the standard Wordpress Exporting tool and the Wordpress importer tool by Wordpressdotorg. It does appear to be shortcode. It's in brackets. [vc_row type=”in_container” full_screen_row_position=”middle” scene_position=”center” text_color=”dark” text_align=”left” overlay_strength=”0.3″ shape_divider_position=”bottom” bg_image_animation=”none”][vc_column column_padding=”no-extra-padding” column_padding_position=”all” background_color_opacity=”1″ background_hover_color_opacity=”1″...
    – Wes
    Commented Jul 10, 2023 at 13:24
  • installing that plugin at the other end will be a hard requirement otherwise those shortcode won't work. If you want to do this without using WP Bakery at the new site when importing then you'll need to replace those shortcodes with an equivalent based on what the new site uses. Most likely this will be a manual process, and depend on what you choose to replace it. Having it output the raw HTML WP Bakery generates will likely result in broken JS and CSS at the other end, and broken functionality as shortcodes generate their HTML at the moment they're viewed
    – Tom J Nowell
    Commented Jul 10, 2023 at 13:35

1 Answer 1


Page Builders that leave code behind are a real pain. I am assuming it left shortcodes behind, which is typical. I don't have a fast and easy solution for you, but I do have one.

You can do this before or after the import. I usually do it after so I'm not wasting time fixing things that weren't moved.

Install the Search Regex plugin. In the plugin itself, you can set up regex commands to do search and replaces on the legacy builder code. This is a long process, since those items can include a lot of different shortcodes behind.

First you want to find all the short codes, but that is fairly easy with this plugin since you can search for the prefix being used and get all results.

Besides identifying the shortcodes you want to replace, you need to create regex replacements with wildcards for maximum impact.

For example, here's a Visual Composer <hr> that I removed using this tool.

[vc_separator color="custom" accent_color="#4899ac"]
My Search 
My Replacement 
<hr />

You also get to preview the changes before you run the script, so you don't need to be anxious about unexpected results. Also - keep track of all of the replacements you're doing so you can repeat the process if something does go wrong.

I've done this same method to remove Divi, WPBakery, and Visual Composer. Hope this helps, sorry I don't have a faster or simpler solution for you.

Here are a few examples for Visual Composer just to help out:

My Search 
\[vc_single_image image="(.*?)"\]
My Replacement 
[image id="$2"]
My Search 
\[vc_custom_heading text="(.*?)" font_container="tag:(.*?)\|.+?"(.*?)\]
My Replacement 

And then I did these two absolutely dead last with no replacements:

My Search 
My Search 
  • There are also some plugins that are made specifically to strip out legacy builder code, but I've never used one to know if they actually work.
    – Faye
    Commented Jul 7, 2023 at 21:26
  • I'm not that great with Regex, but If I go with the Regex search and replace method, could I use the following to identify all of the legacy opening and closing shortcodes? For all opening shortcodes: [vc(.*?)] For all closing shortcodes: [/vc(.*?)]
    – Wes
    Commented Jul 10, 2023 at 13:43
  • You can absolutely wildcard stuff. I personally found that sometimes the content was IN the shortcode - like [vc_text_separator title="Connect Giving Aspiration with Capacity." color="custom" style="double" border_width="2" accent_color="#98cfce" el_class="dsSeparator"] - you can see the title is in there. I added an example of the fix to the answer. You can search for all "[vc" items and get results just to scan through and make sure there's nothing that gets lost.
    – Faye
    Commented Jul 13, 2023 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.