Update File Upload Domain in Wordpress Posts

/ Published in: SQL
Save to your folder(s)

This is a simple SQL statement which will update all the posts within a Wordpress installation changing the domain which files were uploaded to.

Very handy if migrating a site from a test to live environment and all embedded images are referenced using the test url.

Copy this code and paste it in your HTML
  1. UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.TESTDOMAIN.com', 'http://www.LIVEDOMAIN.com')

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.