I migrated my WordPress website to new domain, so I need to update all image URLs in wp_posts, wp_postmeta, and wp_options table which are still pointing to old domain.
These are the SQL syntaxs to update the tables:
UPDATE wp_posts SET post_content = REPLACE( post_content, 'oldomain.com', 'newdomain.com' ); UPDATE wp_postmeta SET meta_value = REPLACE( meta_value, 'oldomain.com', 'newdomain.com' ); UPDATE wp_options SET option_value = REPLACE( option_value, 'oldomain.com', 'newdomain.com' ); UPDATE wp_posts SET guid = REPLACE( guid, 'oldomain.com', 'newdomain.com' );
Excellent…thank you. Only addition I would make is also doing a replace on the “guid” if you had revisions on.
UPDATE wp_posts SET guid = REPLACE( guid, ‘oldomain.com’, ‘newdomain.com’ );
Yes, you’re right. Thanks for the addition.