Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Replacing media urls on WordPress
When you are done with all development and uploaded all contents on a development setup that means all media files and
contents media urls are targeting with your development site.
You can replace all resource and post links to your live site with below written codes in php.
You just need to execute the code with wp query.
Author: Jewel Ahmed
Author Url:
update wp_posts set guid = replace(guid, '', '')
update wp_posts set post_content = replace(post_content, '', '')
update wp_postmeta set meta_value = replace(meta_value, '', '')
update wp_options SET option_value = '' WHERE option_name = 'home' OR option_name = 'siteurl';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment