Last active
August 29, 2015 14:07
-
-
Save tojibon/6b34e4fb7eeb7936b053 to your computer and use it in GitHub Desktop.
Replacing media urls on WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
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 http://www.example.com/dev 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: http:www.codeatomic.com | |
*/ | |
update wp_posts set guid = replace(guid, 'http://www.example.com/dev', 'http://www.example.com') | |
update wp_posts set post_content = replace(post_content, 'http://www.example.com/dev', 'http://www.example.com') | |
update wp_postmeta set meta_value = replace(meta_value, 'http://www.example.com/dev', 'http://www.example.com') | |
update wp_options SET option_value = 'http://www.example.com' 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