I am relatively new to Wordpress, have been handed a site developed by someone else on one server, and have to deploy it to another. This site has bbpress installed, plus a load of other stuff. However it also seems to contain (somewhere) references to the other developers server, so even though I have copied the site onto my server all the links still point to his. I'm assuming that somewhere in the template files or database there is a reference to his site but I don't know where. I've done a search / replace and replaced what I can find, but still the same thing happens. I'm just wondering if there is any really obvious place I need to look for things like that. It seems to me he has just done something pretty stupid by hard coding references to his site; but maybe it's for a good reason, I don't know.


There might be hardcoded links in the theme; download it and do a multifile search with a text editor.

Editing the text dump destroys serialized data; see another Q/A here: Why is my database import losing text widget data?

Update 4/19/2015 To correctly change URLs in the database, the SQL queries below will work when run in phpmyadmin or adminer, but it is much better to use a tool that correctly deserializes/reserializes php data, like https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

If the links are hard-coded into theme files I am afraid you'd need to replace them accordingly.

If you follow what @Brady said you'd need to re-configure the options as step 3 will corrupt the serialised data in the SQL export file.

I would recommand using the WordPress OneClick Migration script. It will update site information when moving WordPress sites from server/site to server/site. It comes with detailed instruction on how to use the migration script in the Readme.md file.

Update (23 June 2011):

Disclaimer: The WordPress OneClick Migration script is written by myself and is opensource and licensed under GPL3.

  • @Azizur - please remember that we encourage full disclosure when referencing our own work/products/services. Please update your answer accordingly and see the FAQs on self-promotion if you have any questions. – EAMann Jun 22 '11 at 18:09
  • @Azizur step 3 will not corrupt the serialized data. – Brady Jun 22 '11 at 20:33
  • @Brady don't assume that everyone have dev.domain.com and moving to www.domain.com it's not always the case and definitely not in this case see the question. – Azizur Rahman Jun 23 '11 at 9:28
  • @EAMann I have updated the answer to include a disclaimer. I have refered to WordPress OneClick Migration script as it's a solution to the problem. I am not here for the purpose for promoting my products and services, you'll find my records proves that. I am not here to sell anything. I have developed this script to help myself and others migrate WordPress site easily. People are free to use it if they wish. – Azizur Rahman Jun 23 '11 at 9:41
  • @Azizur - I've updated my answer to take care of replacing shorter domains to longer domains causing corrupting serialized data. – Brady Jun 23 '11 at 9:44

There is most probably a load of references still in the database.

How I would change the references would be to do the following:

  1. export the DB in SQL file format.
  2. Open SQL file in a text editor that supports find and replace.
  3. Find instance of http://dev.example.com and replace with http://www.example.com
  4. Save SQL file
  5. Drop DB
  6. Import saved SQL file.

EDIT: Because I've always changed URLs from longer to shorter URLs when migrating I've never run into the issue of corrupting SERIALIZED data. If you are changing from shorter URL to longer then the above wont work but you can look at a script found here: http://davidcoveney.com/mysql-database-search-replace-with-serialized-php/

3/15/2015 Edit: Link above is dead; use https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

So to use the above script:

  1. Export your DB and import to your new DB.
  2. Configure script to new DB connections and set your find and replace in the script.
  3. Run script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.