Tag Archives: fields

wordpress url change mysql code

I changed the url of my blog again recently here is some helpful mysql code to renaming a wordpress blog url. YMMV. You’ll need to find all the other fields which containd the old information. I’d like this to be a plugin, it’s more or less a set of simple database commands, but for now cut and paste code will work ok.

 
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_comments` SET `comment_author_url` = REPLACE(`comment_author_url`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'https://px.ns1.net','http://blog.px.ns1.net:81');
 
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://px.ns1.net:81','http://blog.px.ns1.net:81');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,':81//',':81/');
UPDATE `wp_xspf_player` SET `url` = REPLACE(`url`,'https://px.ns1.net','http://blog.px.ns1.net:81');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'https://px.ns1.net/','http://blog.px.ns1.net:81/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'http://px.ns1.net:81/','http://blog.px.ns1.net:81/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'/wordpress/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,"[php]","<pre lang=\"php\">");
 
 UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,"[/php]","</pre>");

update:

UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'ns1.net/wordpress/','ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'/wordpress/wordpress/','/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
 
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://blog.px.ns1.net:81//','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'/wordpress','/');
 
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`,':81','');

[tags]mysql, wordpress, wordpress database, mysql code, code, examples, URL, change, tables, fields, rename, replace, blog, mysql code,cut and paste, database commands [/tags]

Bad Behavior has blocked 780 access attempts in the last 7 days.

>>>>>>> .r246