Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alinademi/20dc00196c352d95966b65853d3a0c98 to your computer and use it in GitHub Desktop.
Save alinademi/20dc00196c352d95966b65853d3a0c98 to your computer and use it in GitHub Desktop.
Removing Visual Composer & Shortcodes From Wordpress Content

Adding @k1sul1's suggestion from the comments as it's more concise than what I had before:

I just wanted them all gone, so I ran this in the MySQL shell.

UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, "\\[\/?vc(.*?)\]", "");

OR You can also do with with WP-CLI:
wp search-replace --regex --verbose "\\[\/?vc(.*?)\]" "" wp_posts

Note the double backslash. If you forget it, you'll replace all v's and c's with nothing, and the shortcodes will still be there. This works for other shortcode as well, just replace vc.

Take a backup beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment