Skip to content

Instantly share code, notes, and snippets.

@sabrysuleiman
Created April 16, 2025 17:24
Show Gist options
  • Save sabrysuleiman/08138bbf4f1f6666b5334b16be33f8cc to your computer and use it in GitHub Desktop.
Save sabrysuleiman/08138bbf4f1f6666b5334b16be33f8cc to your computer and use it in GitHub Desktop.
Find & Replace WordPress Domain
-- 1. Update siteurl and home
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http://site.local', 'https://site.com')
WHERE option_name IN ('siteurl', 'home');
-- 2. Update post content (links, images, etc.)
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'http://site.local', 'https://site.com');
-- 3. Update GUIDs (optional - normally shouldn't be changed unless migrating)
UPDATE wp_posts
SET guid = REPLACE(guid, 'http://site.local', 'https://site.com');
-- 4. Update postmeta
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 'http://site.local', 'https://site.com');
-- 5. Update other custom tables or plugin tables if needed (search first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment