WordPress: from localhost to production

Jul 3, 2013   #php  #production  #wordpress 

Yesterday, a friend of mine asked me urgent help. He fully developed a WP based website for a research project on localhost/his_website. As WP stores full links pretty much everywhere in the database, his website was obviously completely broken when he moved it to production on his_website.com.

I quickly put some PHP lines of codes together to fix the whole DB at once. Feel free to re-use it in your own projects.

usage:

  • put the script on your server, for example /website/root/wordpress_production.php
  • configure DB connection + old and new URL
  • visit http://www.your_website.com/wordpress_production.php (you should see nothing)
  • you’re done !

DISCLAIMER: this script comes with NO WARRANTY. USE IT AT YOUR OWN RISKS.