WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

So when I go on localhost, my development environment loads fine. But when I try to go to /wp-admin, I get redirected to the production URL mysite.com/wp-admin. Where is this being set? I don't want to be redirected.

share|improve this question
Do you have phpmyadmin? Search for other site URL in entire database. Probably somewhere in options. – GhostToast Jun 20 '13 at 21:20
Yeh I do have it. I found it in options too, one called siteurl and one called home and a few more to specific paths. Which one do I change? – Edmund Jun 20 '13 at 21:27
@Edmund Both. Changing just these two will suffice for basic operation on localhost, though links within posts & elsewhere will still point to production site. – TheDeadMedic Jun 21 '13 at 2:21

You can find and replace instances of the old URL in your database but it's best to use a tool that handles serialized data such as BackupBuddy to avoid breaking things like some plugins. Hope this helps!

share|improve this answer
Velvet Blues Update URL's is also a great tool to accomplish this. I always use this when moving sites. – Pieter Goosen Apr 9 '14 at 6:37

Use find and replace to find instances of your old URL and update to your new URL.

Here is a decent article on it.


I wrote a little script that will create the necessary SQL code to put in phpmyadmin's SQL box (please backup DB first though)



You'll just want to search for the top-level domain like so: http://example.com and replace with http://new.example.com - not a good idea to involve any trailing slash.

share|improve this answer

Too bad WP doesnt provide in-built configs for production and local envs like PHP frameworks. You'll have to change siteurl and home in wp_options to the production site URL

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.