Skip to content

Instantly share code, notes, and snippets.

@dgowrie
Created June 28, 2019 22:56
Show Gist options
  • Save dgowrie/b1cdfbb7badc79779f90de6745cded14 to your computer and use it in GitHub Desktop.
Save dgowrie/b1cdfbb7badc79779f90de6745cded14 to your computer and use it in GitHub Desktop.
UPDATE string of text like URLs in WordPress posts SQL query
UPDATE wp_posts
SET post_content = replace(post_content, 'Existing string', 'Desired replacement string')
WHERE post_type = 'post'
-- can do a 'dry run' search, if the tool doesn't offer UI (phpMyAdmin does)
SELECT *
FROM wp_posts
AND post_content LIKE '%Existing string%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment