Whenever I am porting my new WordPress application from my development server to the live I face this problem that the urls of the images, etc that are inserted from the editor's browser in the wordpress backend, have the absolute base urls of the current server.

So if I am on my development server, http://development.com/new_site/ all the images' urls will be attached with the absolute full url of the server too.

The way around I found at the begining was just manually change them going to the edit page on each and every page and post. But its tidious and time consuming so, I found this trick and is really helpful, does all in just a second or two.

UPDATE wp_posts SET post_content = REPLACE(post_content,'DEV_URL','LIVE_URL');

This is a simple sql query which will replace each and every occurance of DEV_URL (may look like http://development-server.com/new_site or http://192.168.0.55/new_site if you are on local machine) with LIVE_URL which is your live site's URL.

This is an SQL query , It can be used on any application and may help in many other case, but for me It was perfect for the wordpress development.

Comments

comments

Uncategorized

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.