How to Replace Old Domain URL in wp_posts Table

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' );

mysql replace

Comments
  1. erubinoff Reply
    • kumkum Reply

Leave a Reply

Your email address will not be published. Required fields are marked *