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 have downloaded my site to a production environment. I have set up both the live site and the production site to use the same DB. When i login to the admin panel i get redirected to the live site. I know that wordpress stores URLs in the DB so i want to modify (hard code) my production site not to redirect anywhere.

Where and how?

Edit: I found the solution to this particular problem here http://www.davidpaulellenwood.com/expression/267/

But when one problem was tackled two new ones appeared and as discussed below, it's not worth it.

share|improve this question

migrated from stackoverflow.com May 29 '12 at 15:09

This question came from our site for professional and enthusiast programmers.

Honestly, you should not be using the same database for development and production. You should sync the live database to your dev copy so you maintain the most current information. What happens if your new code wipes out all of your live content? Seems like a nightmare. – MetalFrog May 29 '12 at 15:11
You probably should set up a sandbox: codex.wordpress.org/Test_Driving_WordPress – Ryan B May 29 '12 at 15:15
@MetalFrog I'd be willing to take that chance :( – Johan B May 29 '12 at 15:29
@RyanB Yea, kinda limiting though – Johan B May 29 '12 at 15:31
@JohanB how so? – Ryan B May 30 '12 at 13:22
up vote 0 down vote accepted

I think getting the site to redirect to the proper location on login would only be the beginning of your issues with this setup.

What would happen when you want to use any WordPress function to retrieve the site url? You would possibly have to re-write those functions as well, so that they return the production url instead of the url from the database.

If your production site is on your local machine you might try editing your HOSTS file so that your local machine thinks that its the real server. When you are finished working on your local machine you could then switch your hosts file back to normal to see the real live site again.

Check this URL http://wpmututorials.com/how-to/using-a-hosts-file/ for more info on using a hosts file.

share|improve this answer
I'm marking your answer as the solution. I got the login problem solved and as you said that was just the beginning so i'm leaving this approach. – Johan B May 30 '12 at 9:00
davidpaulellenwood.com/expression/267 This was the post that helped me out – Johan B May 30 '12 at 9:08

This is a REALLY, REALLY bad idea.

I don't want to tell you how to do it but some messing around with the site_url filter could possibly achieve what you want, but I really think you shouldn't try.

share|improve this answer
Please do not use answers for discussion. You will be able to leave comments when you gain some reputation on site. – Rarst May 29 '12 at 15:50
It's very good idea. you can really test that everything will work if you publish your changes to public. – Tommixoft May 29 '12 at 16:41

In addition to what @Matt Elliott said.

It's not just the DB you need to worry about, .htaccess works with wordpress to craft your permalink structure, this all begins from the root of the site and works with the Apache to formulate the correct front-end URL's based on URL parameters.

If you had some apache chops you might be able to tackle this.

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.