Fixing URLs after moving a WordPress blog
When I moved my WordPress blog, all my image links were broken Fortunately, with a simple google search (mysql replace substring), and 5 minutes of work in phpMyAdmin, everything was right as rain.
I ran the command (adapted from a comment here) on two fields in the wp_posts table - wp_content and guid:
UPDATE wp_posts
SET [insert_field_name_here] =(
REPLACE ([insert_field_name_here],
'[insert_old_URL_here]',
'[insert_new_URL_here]'));
One browser refresh later, I was returned to multimedia heaven
And those that link to you are very happy to receive an email about it
What is the insert_field_name_here supposed to mean? Not sure what this is. I have gone into PHP Myadmin and clicked on the database, opened the SQL tab and I want to run this, but I have no clue as to what the field name is. What are you supposed to put in there?
@Jamie For each field that contains the old URL, execute the statement replacing [insert_field_name_here] with the field name. For example:
UPDATE wp_posts SET guid = (REPLACE (guid, ‘www.oldurl.com’, ‘www.newurl.com’));