Return to Snippet

Revision: 23337
at November 11, 2012 05:55 by johnandrewsroot


Updated Code
SET	@current_path='site.dev.example.com', 
	@new_path='site.stage.example.com';
	
UPDATE wp_posts 	SET post_content 	= REPLACE(post_content, @current_path, @new_path);
UPDATE wp_posts 	SET guid		= REPLACE(guid, @current_path, @new_path);
UPDATE wp_options 	SET option_value 	= REPLACE(option_value, @current_path, @new_path);
UPDATE wp_postmeta 	SET meta_value 		= REPLACE(meta_value, @current_path, @new_path);

Revision: 23336
at February 4, 2010 10:29 by johnandrewsroot


Updated Code
SET	@current_path='site.dev.example.com', 
	@new_path='site.stage.example.com';
	
UPDATE wp_posts 	SET post_content 	= REPLACE(post_content, @current_path, @new_path);
UPDATE wp_posts 	SET guid		= REPLACE(guid, @current_path, @new_path);
UPDATE wp_options 	SET option_value 	= REPLACE(option_value, @current_path, @new_path);
UPDATE wp_postmeta 	SET meta_value 		= REPLACE(meta_value, @current_path, @new_path);
UPDATE wp_termsmeta	SET meta_value 		= REPLACE(meta_value, @current_path, @new_path);

Revision: 23335
at February 4, 2010 10:29 by johnandrewsroot


Initial Code
SET	@current_path='site.dev.example.com', 
	@new_path='site.stage.example.com';
	
UPDATE wp_posts 	SET post_content 	= REPLACE(post_content, @current_path, @new_path);
UPDATE wp_posts 	SET guid			= REPLACE(guid, @current_path, @new_path);
UPDATE wp_options 	SET option_value 	= REPLACE(option_value, @current_path, @new_path);
UPDATE wp_postmeta 	SET meta_value 		= REPLACE(meta_value, @current_path, @new_path);
UPDATE wp_termsmeta	SET meta_value 		= REPLACE(meta_value, @current_path, @new_path);

Initial URL


Initial Description
If the official codex approach (http://codex.wordpress.org/Changing_The_Site_URL) is causing you problems, give this a try. Be sure to change the constant declarations and modify table names as necessary for your instance. Confirmed working with WP v3.4.

Initial Title
Wordpress updating URL paths after address change

Initial Tags
url, mysql, path, wordpress

Initial Language
MySQL