Delete all Visual Composer Shortcodes saving content

I’m trying to import 200 posts from an older wordpress, with a lot of visual composer shortcodes in the content.

Is there any way to delete all shortcodes and save the content?

Related posts

Leave a Reply

1 comment

  1. Programmatically this can be done with visual composer activated and resaved content like this:

    for each all posts
       post->post_content = do_shortcode(post->post_content)
       save(post)
    endforeach
    

    What I mean – all shortcodes need to be rendered to get it HTML and save it as new post content. This will allow to “strip” all shortcodes but save the markup generated with visual composer. But note that you will need to manually enqueue styles/css for visual composer elements.