• Hi!! I’m trying to remove some code from my databases using WP CLI but I’m having trouble with the search-replace wildcards. I’ve so far been unable to find an example of the syntax.

    This is what I have so far:
    wp search-replace ‘<noindex><script id=”wpinfo-pst1″*</script></noindex>’ ” wp_posts wp_postmeta wp_terms –dry-run

    I want to clear all the text that includes, and is between:
    <noindex><script id=”wpinfo-pst1″
    and
    </script></noindex>

    Thank you so much for your time!
    -Mike

Viewing 2 replies - 1 through 2 (of 2 total)
  • Make a backup 1st of course.
    wp search-replace '<noindex(.*?)>(.*?)<\/noindex>' '' --regex wp_posts wp_postmeta wp_terms --regex-flags='ms' --dry-run
    Make a backup 1st of course.

    Thread Starter calimer

    (@calimer)

    Thank you so much!! I was going crazy trying to find some good examples from the WP CLI documentation but I didn’t realize that it is using (I’m strongly assuming) php syntax.

    I can’t thank you enough, this helps a ton!
    -Mike

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP CLI Search-Replace Wildcard Usage’ is closed to new replies.