WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to manage my WP site in local, then sync it to my git, and then automatically deploy it. In fact, I already have my site in production, and trying to make it work in local. The fact is I can make it work in local, but every link send me to the distant domain : mydomain.com instead of managing localhost.

How should I manage it???


share|improve this question
up vote 0 down vote accepted

It sounds like you need to update the database to replace the guids and base URL.

I recommend WP Migrate DB Pro to quickly sync two databases. Otherwise you need to run a few SQL statements to find and replace the old domain with the new domain. In PHPMyAdmin run the following statements from the SQL window. Replace old-domain with your exact distant domain, and the new-domain with your complete local address.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com', 'http://www.new-domain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

Doing so will solve 90% of your link issues.

share|improve this answer
Well, I'm in the 10%, I ran the query, but nothing changed. I will see the WP Migrate DB Pro, it sounds great ! – Juliatzin del Toro Aug 21 '14 at 18:17
what does it list as your url in General Settings area? – Aris Blevins Aug 21 '14 at 18:54

Now it is working, I've updated wp-config.php and added 2 lines :


Tx !

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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