Skip to content

Instantly share code, notes, and snippets.

@gerrgg
Last active September 26, 2019 21:50
Show Gist options
  • Save gerrgg/dbc8b63efadf62ddc4edbce02025b980 to your computer and use it in GitHub Desktop.
Save gerrgg/dbc8b63efadf62ddc4edbce02025b980 to your computer and use it in GitHub Desktop.
How to remove Visual Composer Shortcodes from Wordpress content. Bash script which strips WP Bakery shortcodes from wordpress content.
# Greg Bastianelli
# 26-09-1994
# Requires WP-CLI
# Regex's from https://gist.github.com/gemmadlou/7a0189bfae6c2c7268de12f1de822b8a
# Uses an array of regex specifically designed to trim off all wp-bakery visual-studio from your wordpress content.
declare -a arr=("\[/vc(.*?)\]" "\[vc(.*?)\]" "\[custom_font(.*?)\]" "\[/custom_font(.*?)\]" "\[/vc_column_text(.*?)\]" "\[vc_separator(.*?)\]" "\[/vc_column(.*?)\]" "\[vc_row(.*?)\]" "\[portfolio_list(.*?)\]");
for i in "${arr[@]}"
do
printf "$i\n"
wp search-replace "$i" "" --regex --regex-flags='i'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment