SQL | find and replace links

UPDATE wp_posts SET guid = replace(guid, 'http://old','http://new'); UPDATE wp_posts SET post_content = replace(post_content, 'http://old', 'http://new'); UPDATE wp_links SET link_url = replace(link_url, 'http://old', 'http://new'); UPDATE wp_links SET link_image = replace(link_image, 'http://old', 'http://new'); UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old', 'http://new'); UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://old', 'http://new'); /*UPDATE wp_options SET option_value = replace(option_value, 'http://old', 'http://new') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/ UPDATE wp_options SET option_value = replace(option_value, 'http://old', 'http://new') /*or*/ UPDATE wp_options SET option_value = replace(option_value, 'http://old', 'http://new') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://old','http://new'); UPDATE wp_posts SET post_content = replace(post_content, 'http://old', 'http://new'); UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old', 'http://new');

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.