Created
April 16, 2025 17:24
-
-
Save sabrysuleiman/08138bbf4f1f6666b5334b16be33f8cc to your computer and use it in GitHub Desktop.
Find & Replace WordPress Domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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