Skip to content

Instantly share code, notes, and snippets.

@mgratch
Created August 3, 2018 16:52
Show Gist options
  • Save mgratch/e0cc0a07cddc6f42434f6a6e07516ea6 to your computer and use it in GitHub Desktop.
Save mgratch/e0cc0a07cddc6f42434f6a6e07516ea6 to your computer and use it in GitHub Desktop.
Declare an array of shortcodes and replacement values, iterate over each and search and replace all instances in the DB.
declare -A array=([x-large]='h1' [large]='h2' [medium]='h3' [small]='h4' [x-small]='h5' [xx-smal]='h6');
for key in ${!array[@]};do
printf "Start [$key] Search\n";
wp search-replace "[$key]" "<${array[$key]} class='headline headline--slab headline-get-page-color'>" --all-tables --precise --recurse-objects --format=count;
printf "Start [/$key] Search\n";
wp search-replace "[/$key]" "</${array[$key]}>" --all-tables --precise --recurse-objects --format=count;
printf "Next Search\n";
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment