Skip to content

Instantly share code, notes, and snippets.

@szbl
Created February 26, 2015 17:27
Show Gist options
  • Select an option

  • Save szbl/64c67a7fb5d8f304aa1a to your computer and use it in GitHub Desktop.

Select an option

Save szbl/64c67a7fb5d8f304aa1a to your computer and use it in GitHub Desktop.
-- Update options (site url, home)
--
UPDATE wp_options
SET option_value = REPLACE( option_value, 'http://url1', 'http://url2' )
WHERE option_value LIKE 'http://%';
-- Update post content
--
UPDATE wp_posts
SET post_content = REPLACE( post_content, 'http://url1', 'http://url2' );
-- Update meta variables that may contain old links
--
UPDATE wp_postmeta
SET meta_value = REPLACE( meta_value, 'http://url1', 'http://url2' );
@szbl
Copy link
Author

szbl commented Feb 26, 2015

UPDATE wp_options 
SET option_value = REPLACE( option_value, 'http://meuller.pw', 'http://nick' )
WHERE option_value LIKE 'http://%';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment