How to Setup Temporary WordPress Staging Site

Temporary staging site on the same database. Steps: 1. Copy the site files; 2. Point a domain at the copy; 3. Edit wp-includes/options.php; 4. Return the dev URL
© juzhax.com

I’m going to Setup Temporary WordPress Staging Site using same MySQL database. It is very useful for you to develop themes or plugin without affect to your current running sites, and you need to use real data to test it out.

Prepare your contents

Copy all your current contents from
[code lang=”bash”]
/var/www/juzhax.com
[/code]
to
[code lang=”bash”]
/var/www/dev.juzhax.com
[/code]
Set a domain and Point your Apache or Nginx to

Modify WordPress file

After that edit the file in wordpress
[code lang=”bash”]
/var/www/dev.juzhax.com/wp-includeds/options.php
[/code]
Inside the function get_option

Put this code, save it.

Put the codes

[php]
if ($option == "siteurl" || $option == "home") {
return "http://dev.juzhax.com";
}
[/php]