Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Create Staging Environment for a WordPress Site

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Create Staging Environment for a WordPress Site

As WordPress beginners progress in their career, their site grows as well. When running stable and professional websites, editing everything live is not the best option. Several of our users asked us for a tutorial that explains the process of creating a staging environment. In this article, we will show you how to create a staging environment for your WordPress site.

Note: This article is more suitable for the users who want to move from beginner level WordPress development to a little more advance development. This article will help you from cow-boy coding and learn the best practice. This is what you are going to learn by the end of this article.

  • Creating a Staging Site
  • Using Git and BitBucket
  • Pushing Changes From Local Server to BitBucket
  • Deploying Changes from BitBucket to Staging Site

What is an Staging Environment?

To work on a WordPress site, we recommend our users to install WordPress locally on their Windows or Mac computers. Once you are done and satisfied with your website, then you can upload it from localhost to live server.

There is one problem with this approach. What if something that worked on your localhost does not work on the live server? This would cause errors which can be a problem for established sites because it can affect search engine rankings, sales, first impression on users, etc.

Instead of uploading your changes to the live site, you can upload them to a staging site on the same server. A staging site is a separate development area on your site (usually a sub-domain) with restricted access. This is where you can test your changes or use it for all your development. Once you have thoroughly tested your site, you can then upload it to your live site.

If you’re a beginner and don’t want to learn the complicated process highlighted in the article below, then we recommend that you select a managed WordPress hosting provider like WPEngine which offers built-in staging functionality. Our friends at SiteGround also offers the staging functionality in their grow-geek plan which is much more affordable.

Setting up Staging Environment Using cPanel

First thing you need to do is to create a subdomain on your main domain. A subdomain will allow you to run your website in a separate folder, not affecting your main database, files, or uploads.

To do this, log into your cPanel (other control panel’s will be similar, look for Domains or Subdomains), Under the Domains sections, you need to click on Subdomains.

cPanel Subdomain

On the next screen, enter the name you’d like to use for your subdomain (typically staging or dev) and then choose your main domain from the drop down menu.

Creating a subdomain for staging site in cpanel

In cPanel, this should automatically fill in the Document Root text box with a location based on the name of your subdomain. You can change this if you’d like, but usually the default will be okay (public_html/staging).

cPanel Subdomain Configuration

Now you just need to click Create when you are done. It should confirm, and show the subdomain in the table below.

cPanel Subdomain Confirmation

You can verify that your subdomain has been set up by visiting it in your web browser. It should display something similar to this:

Subdomain configured

Now you need to create a separate FTP account for your staging environment. A dedicated FTP account will only have access to your staging directory preventing accidental changes to your live environment.

cPanel FTP Accounts

In cPanel, navigate to the FTP Account section. Complete the fields in the Add FTP Account section.

cPanel Add FTP Account

The Directory should match the directory you specified when creating your subdomain. Click Create FTP Account to create your new account. This account will only have access to the directory you specified not the entire server.

Copying Data From Live Site to Staging Environment

Now that you have setup your subdomain, the next step is to copy the data from your live site to your staging site. This will allow you to test changes in your staging environment with the same data without affecting your live site.

The easiest way to do this is through phpMyAdmin. Log into phpMyAdmin via cPanel, and select your current live database. Once you have selected your live database, click on the Operations tab in the menu bar.

Copying database using phpMyAdmin

Here you need to look for the Copy Database To box. In the text box, enter the name of your staging database (if you haven’t created it yet, ensure CREATE DATABASE before copying is checked and give it a name such as example_staging). You need to copy both the structure and the data as well as making sure that you keep the remaining settings as default. Click Go to run the copy. Remember for larger databases this may take some time.

phpMyAdmin Copy Database To

Once your database has copied, you need to select it from the sidebar on the left. phpMyAdmin will now open your newly copied database. You need to clicki on SQL tab in the menu bar of phpMyAdmin.

Running SQL query in phpMyAdmin

Now we will replace all references of our live site to the staging site to make sure that everything works fine when we use this database for staging. To do that you need to run the following SQL queries.

UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');

Enter the above queries into the SQL query box, replacing the following values:

  • ORIGINAL_URL – your original site URL e.g. . You can find this in your WordPress Admin under Settings > General > WordPress Address (URL)
  • NEW_URL – enter your new URL, this will be the one of your staging site created earlier (be sure to include http:// – e.g.
  • wp_ – If your website has a custom prefix on database tables, make sure you replace wp_ with that.

Click Go to run the queries. A confirmation message will show when this is complete.

After copying your database, you need to copy your WordPress files, plugins, themes, and uploads. First download a fresh copy of WordPress from Upload the contents of WordPress to your staging site. Note, do not run the WordPress install yet.

Once you have uploaded WordPress, the next thing you need to copy is media files, plugins, and themes. The following folders will need to be copied :

  • /wp-content/uploads
  • /wp-content/themes
  • wp-content/plugins

If they are small, then you can download them from your live site via your FTP client and upload them into your staging folder. However for larger folders, this can often be time consuming. cPanel’s file manager allows you to copy folders directly on the server making the process much quicker.

Login into your cPanel dashboard and click on the File Manager under Files section.

cPanel File Manager

cPanel will launch the file manager. You need to navigate to your live site’s wp-content directory (typically /public_html/wp-content) where you would be able to see your themes, plugins, and uploads folders.

cPanel File Manager wp-content

For each folder, you need to right-click and select Copy. This will bring up a dialog box, choose the location where you want the folder to be copied. We want to copy it to the directory we have created for the staging subdomain. It is also the directory where you uploaded WordPress in the previous step. /public_html/staging/wp-content/

cPanel Copy Folder

This will copy each folder into your staging wp-content directory.

cPanel Copy Dialogue

You need to repeat this this for each of the above directories (plugins, themes, and uploads).

Note: In some WordPress hosting environments you may not be able to use a file manager in which case you will have to manually download these directories to your computer and then upload them back to staging site or use SSH.

Once you have copied these directories, you are ready to connect your staging installation of WordPress to the database you copied earlier.

Access your staging site, via the subdomain we previously created. If your staging directory doesn’t contain a wp-config.php file, WordPress will attempt to create one asking for your database connection details. If it does have a wp-config.php file, ensure you edit it to use your new staging database connection details.

Once WordPress has connected to your staging database, it should detect that WordPress has been installed, and prompt you to login. Your login details will be the same as on your current live site.

Any changes you make to your staging environment will now be independent from your live environment. This means that you are free to change settings, install new plugins, edit theme files, and more without affecting the experience for your customers.

Configuring and Troubleshooting Your Staging Environment

Once you have logged in to your staging WordPress installation, there are a number of settings that should be configured before continuing.

Ensure Your Domain is Correct

Look at the URL of your admin screen. If it is your subdomain, then it has detected the new configuration. If not, then the SQL queries run earlier will not have changed your site URL within the staging database. Look for the siteurl and home option_name’s within the wp_options table.

Ensure Your Media has Copied

Visit the media section of your WordPress Administration and check whether your images/videos/etc. are in place. If so, then your uploads directory will have copied correctly. If not, then ensure that the uploads directory is in the correct place (typically /public_html/staging/wp-content/uploads).

Disable XML Sitemaps in WordPress SEO

If you are running WP SEO, then you need to make sure that XML Sitemaps option is disabled. This will help prevent search engines from indexing your staging environment.

Disable XML sitemaps

Restricted Site Access

To prevent users from accidentally visiting your staging site, you need to install and activate, Restricted Site Access. Upon installation, go to Settings > Reading to configure the plugin.

You also want to go in the Settings » Reading section and make sure to disable indexing of this site by search engines. You want to make sure that you do this to prevent any duplicate content.

You can also password protect the entire directory with htpassword. The method shown in the tutorial is for /wp-admin/ but you can modify it for any site folder.

Update Permalinks

Visit Settings > Permalinks and click Save to ensure your permalink structure is up to date. If you are getting 404 errors on your staging site, then this is often the cause.

Pushing Changes to Staging From GitHub or BitBucket

Most professional developers like to use a version control system like SVN or Git to track their development progress. Using a version control system allows you to go back in time if something goes wrong because all your code history is stored in a central location. It also makes collaboration easier as all changes are stored on a central location, developers have the access to all the changes made to a project.

GitHub or BitBucket, Which One You Should Use

Both, GitHub and BitBucket are project hosting service and both allow you to use Git for your projects. GitHub is more popular among open source project developers and has a larger community of developers. If the project you are working on is an open source WordPress plugin or a theme, then you can host it on GitHub. Your project will be publicly visible and other users will be able to see your source code. To create a private repository on GitHub you would need to upgrade to their paid plan.

On the other hand, BitBucket allows you to create private repositories for free. If you are working on a client’s site or your own personal site, then you would probably want to keep your work private. BitBucket makes it easier for you to do so.

Getting Started With BitBucket

Step 1. Installing Git

First thing you need to do is download and install Git on Windows (or Mac).

Step 2. Creating Your First Repository

Now that you have installed Git, the next step is to signup for a free BitBucket account. Once you have signed up, you will enter BitBucket dashboard where you need to click on the Create new repository button.

Creating a new repository in BitBucket

Enter a name and description for your repository something that helps you identify your project. To make your repository private, you need to check the box next to Access Level. Lastly, make sure that Git is checked as your repository type. You can leave rest of the options unchanged and click on the create repository button to proceed. BitBucket will now create a blank repository for you.

BitBucket new blank repository

Since you will be working on your local WordPress installation, click on I have an existing project to push up.

Step 3. Add local directory to Git

You are all set to push your local WordPress project to BitBucket. Launch Git Bash on your computer. Yes, it is a command line tool and you will have to type commands, but don’t worry it is super easy.

If you don’t want to use the command line, then you can use GUI interfaces like Github for Windows (which works for Bitbucket as well) and/or TortoiseGit.

First you need to add your local WordPress project folder as a repository in Git. Remember, you don’t need to add your entire WordPress directory to the project. If you are working on a theme, then you can just add that theme directory as a Git repository.

In Git Bash, first move to your project directory by typing the path to your project directory and then add it to Git:

cd /C/xampp/htdocs/wordpress/wp-content/themes/myawesometheme
git init

Now that you have added your project to Git, the next step is to add all files into it.

git add . 

After adding all your files, the next step is to make your first commit.

git commit -m "Adding all project files as the first commit" 

Step 4. Sync changes with your Bitbucket repository.

Now the final step is to Sync your local files with your BitBucket repository. Type in this line in Git Bash to connect your local repository to your BitBucket repository.

git remote add origin

Push all your files to the BitBucket repository.

git push -u origin --all # pushes up the repo and its refs for the first time

Congratulations, you have successfully synced your local WordPress files with your BitBucket repository. Now lets make some changes to files in your local repository. Once you are done making changes, you need to commit those changes to Git.

git add . 
git commit -m "Added new features"
git push -u origin --all

Deploying Changes From BitBucket to Staging Site

Now that you have learned how to use Git with BitBucket, it is time to deploy changes from your BitBucket repository to your staging site. This way you can work on your site locally and test your changes on your staging site without affecting your live site.

To do that, we recommend using Ftploy. The basic free account allows you to setup one project. It monitors changes made to your BitBucket repository and then deploys them to your web server. First you would need to sign up for an account on Ftploy. After that, you need to add your server details.

To configure a new server, select Servers » New Server from the navigation at the top.

FTPloy New Server

Complete the appropriate fields with the settings you created when you configured your staging FTP account earlier.

FTPloy Server Configuration

Click Test Connection to ensure FTPloy can connect to your server, and then click Save Server.

To create a project, select Projects » New Project from the navigation menu, selecting GitHub or BitBucket where appropriate.

FTPloy New Project

If you have previously defined your server, you can select it from the drop down menu (otherwise, enter the details in the appropriate fields). In the Server Path field, enter the path to your themes directory (this will change depending on the structure of your repo, but /wp-content/theme/your-theme will be suitable if your repo contains only your theme).

FTPloy Server Path

When you push a change to that BitBucket repository, FTPloy will pick up the changed files and push them to your selected server.

Pushing Changes to Live

If you are using FTPloy to deploy your changes from a repository to your staging server, you could set up a similar process for your live server. However, if incorrect or faulty code was pushed to your repository, that would go out to your live site automatically.

It is recommended to run an automated deployment system such as FTPloy for a staging server and then manually copy over the required files to your live site when you are happy with the changes and have thoroughly tested them on your new staging environment.

We hope that this article helped you learn how to create staging environment for your WordPress sites. For troubleshooting check out our guide of most common WordPress errors and how to fix them. For feedback and questions feel free to leave a comment below.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Mark Park says:

    Great article! Just one thing that isn’t clear to me.

    If I have the current non-wordpress website on a domain name and I want to build a new website using WordPress and develop it on a staging environment on a sub-domain – is this possible?
    Can I make a sub-domain and install WP on the same server used by the current non-WP website?
    Later when the website is finished I want to connect my WP developed site with the domain name

    Thank you for your help.

    • WPBeginner Support says:

      Yes this is possible. Make sure you block search engines on your development subdomain.

  2. Benito says:

    Hello, great article, but what if I don’t want to use XAMPP, and I just want to use a subdomain as a staging site and then push changes to live? What would be the best way to deploy the changes?

  3. Raj says:

    Will this process create a Database User and add it to the database we created while copying giving it all privileges by itself? or do we need to create a database user at some point?

    • Raj says:

      Okay I tried it.. both ways.
      Once I created the database user before installing wordpress on the staging site and it worked. The other time around, I didn’t and got the issue “We were able to connect to the database server (which means your username and password is okay) but not able to select the a*******_ata_d2db database.”

      That to me means that one has to create a user manually, only copying database won’t do. Right?

  4. Gayle says:

    Terrific resource! Reached a WP staging breaking point and then found this. Lifesaver! Thank you! Only things I’d add would be some meta information for newbies like me. : )

  5. LizP says:

    Yikes, too hard for me!

  6. Deborah says:

    Thanks for the tutorial. I seem to be stuck on one of the very first steps. When clicking go after changing the URL’s in SQL, I get a message of ‘# MySQL returned an empty result set (i.e. zero rows)’
    This is how I’ve entered the data:

    UPDATE wp_options SET option_value = REPLACE(option_value, ‘’, ‘’);
    UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘’, ‘’);
    UPDATE wp_posts SET guid = REPLACE(guid, ‘’, ‘’);
    UPDATE wp_posts SET post_content = REPLACE(post_content, ‘’, ‘’);

    Can anyone please help me with this?


  7. Andreas Kofoed says:


    First of all thanks for an amazing tut on this.

    I’ve encountered one problem so far and that is when I try to enter my subdomain through I get this message: err_connection_timed_out ???

    • Andreas Kofoed says:


      I figured this out as I was due to some table prefix.

      Now my is up and running, but the styling and layout is totally different.
      How do I do, so my files in my child theme applies to the current theme???

      It seems like it is missing a lot of pictures, css and some basic settings?…

  8. Patrick says:

    Thanks for this great tutorial!

    I’m finding that after setting everything up, comments on the live blog are now going to the sub-domain staging blog. I can’t find anything in the settings that explains this behavior. Do subdomains perhaps take precedence for some reason?

    Any ideas?

  9. Arjun Singhal says:

    I got errors regarding SSL certificates. I am a newbie when it comes to using Git and the command prompt on my Mac. So I couldn’t get to syncing everything like I wanted.

    Also, how it appears is that the steps are good to sync the local disks files to the server – changes in the theme folder etc.

    However, there is no syncing mechanism highlighted for the MySQL server changes in the case of WordPress.

  10. Evan says:

    I don’t know. This just seems really confusing.

    So, a Git Bucket is like an intermediary between your local computer and the hosted dev server? For example, if I have then I create then I create an account and empty repository in Git Bucket then I create an empty folder on my local computer, and I edit files locally and sync them to the Git Bucket repository and then how do I commit to the live site? Is there any connection and control to the live site? It seems like from here, you sync your Git Bucket repository to the

    Then what? I wish this article had a diagram to understand how this all works. It might make sense to you guys because you do it all day, but for the first time, this is a dizzying experience. Especially since multiple points in this setup failed and I had to go about custom fixing each one. At this point, I have created, copied all files from the live site to it, copied the database, connected it in, logged into the wordpress site, made sure all is cool, but now … I am lost as to what I do next.

    In your article, you ask us to INIT a local directory on our computer. Well, I’m trying out Git Bucket’s SOURCE TREE, which by the way looks great. But now what? Any help on what is the procedure from here? What’s the logic to all this?

    I create a folder on my local drive, it syncs to a Git Bucket Repository so that people can develop collaboratively. But who uploads the changes to the server? Don’t users need to be able to do that to see live changes on the server? So how does that all connect?

    And how do you update the final changes to the live website once you’re ready? Man I’m confused. I spent 3 days getting this setup and I can’t figure out this next step, because I don’t understand how that all works.

    Any help?

    • Oscar says:

      Hi Evan, although I am sure you figured it out by now as its months later, I figured it may help others with the same question. After you have committed your code to version control, you would move your changes over to the server of your choice (dev/staging/production) using the deploy feature. This is described in the section above titled, “Deploying Changes From BitBucket to Staging Site”. Hope this helps clarify!

  11. vjohnson says:

    I am truly a beginner at this, and I have read the article a couple of times. I think my environment is almost set up, the piece that appears to be missing is in the install step. The directions say copy the files but do not install “yet”, when in this process do I run an install of wp? I am unsure if some of the issues that i ran into are due to my host which is hostgator or something that I’ve done wrong. Any input would be great.

    What is happening at this point is no errors but nothing is rendered on at the url for my staging area.

  12. Martin says:

    Nice article. Although, the whole way, you’re talking about setting up a development site on the server as a subdomain. But at the end your using a local Xammp server.

    How would you setup a test environment on the server where the doomain is hosted? Do you use bitbucket for it as well?

    Thanks, cheers.

  13. Alberto Serrano says:

    Hello , I made a staging site successfully but my live site already had a little problem with a plug in , I contacted the developer and he asked for my admin credentials , following your advice on other article I gave him log in credentials to my staging site and he fixed the issue , to make the changes on the live site he told me to import the database from the staging site to the live site , my concern is the sql changes I made to the staging database , if I copy the database isn’t my live site going to redirect to the staging site now ? I can’t find the SQL queries to delete them

  14. isagani says:


    nice article, i followed all instructions and gave me a clean view process on using git and staging environment. hope all experienced people do what you did so many can step forward from beginner to advance.

    Thanks a lot.


  15. Kristof Bernaert says:

    Just a perfect article that helped me to setup the whole thing.

    My staging environment is on the same shared linux hosting, just in another directory.
    I used this also as the repo for git.

    With Coda, I’m working online in that staging. As I save changed files (mainly css), I see instantly the updates.
    So I don’t need the local files on my laptop.

    But how to checkout those remote files under the staging folder, without fetching a local copy?


  16. bcall says:

    Thanks for the article!

    I have one problem, though: I have two databases and am not sure which one (or maybe both) is connected to my live site. I checked the wp-config.php file and it’s linking to a database with a different name, one that does not appear in my database list (in phpMyAdmin). Is it possible that the database was renamed?

    • Nick Jubrey says:

      Look in your wp-config.php file that’s where wp is directed to that particular database, the db your using will be listed there.

  17. Tiffany Johnson says:

    I’m having some issues with the dev site recognizing my theme and content. I copied over the following files prior to running my installation of wordpress, however the pages and content are still not being recognized. I checked the files and my media is in the uploads file, my themes are present, as are my plugins, but none of them are recognized in the actual wordpress site.


    Any suggestions on what else I can try? Thanks!

  18. Brad Scott says:


    For my case.

    Create subdomain:
    Create Document Root: public_html/staging

    Need to run the following SQL queries:
    The NEW_URL should be not


    Cheers & Thanks

  19. Paula Lay says:

    Thank you so much for this tutorial! The step-by-step instructions are perfect for someone who hasn’t done this before. I encountered a snag where I was getting an error message after creating a subdomain (something like a problem configuring the DNS). For anyone that encounters this problem – clear your browser cache and cookies, and then you will see the correct screen. Took me days to figure this out (I gave it a few days because I thought it would take 24hrs or so for the domain to propogate).

  20. Random Dev says:

    Whoa. Wouldn’t it be simpler, cutting down on quite a few steps and reducing the technical nature of this process, to just use a backup plugin with a migrator (search/replace the database) function… instead of copying the databases manually, *and* instead of using Git/Bitbucket? Or am I not understanding something?

    • Cannonpult says:

      For smaller sites, maybe. But plugins like Duplicator start to fail or have significant diminishing returns on larger sites. For example, if you were working on a site with a lot of media, Duplicator will never be able to transfer everything. You will get warning messages and have to leave media behind in the transfer.

      Yes, this tutorial would be overkill for a small blog. But it’s absolutely the way you should go for say, a woocommerce site with 3,000 products (including images and custom data).

      The other big consideration is frequency of changes. Some sites are fairly hands-off after they go live. Maybe you just update core + plugins and perform a few minor changes per year. Other sites might require weekly or even more frequent changes. If this were the case, it would become a pain to wait for backups and then drop a backup on the new site (crossing your fingers that it works each time). By using the method described in the tutorial, you can commit smaller changes at a time right after testing them.

  21. mgiulio says:

    Excellent article.I was looking for info about best practices for wordpress staging sites. The additional section on the git-bitbucket workflow is very much appreciated.

  22. nwesource says:

    Fantastic tutorial, thank you! I know has a staging site built into their hosting options which seems fantastic although I haven’t tried it just yet. Are there any other easier options you know of to setup and operate a staging site, with more of a plugin functionality like WPEngine? They literally have a clone to staging button and a clone to live button that makes this seem like a process from the 80’s LOL… :-)

    Amazing tutorial, thank you for enterprise level content!

  23. WPBeginner Staff says:

    No you first need to extract the zip folder and then upload the contents of wordpress directory to your staging site.

  24. Tony Leary says:

    Can someone elaborate on this one step:

    “First download a fresh copy of WordPress from Upload the contents of WordPress to your staging site. Note, do not run the WordPress install yet.”

    I read that as “1) download WordPress zip file from and 2) upload .zip file to /staging folder via File Manager.” However, I don’t think that’s correct.

  25. WPBeginner Staff says:

    Most probably your subdomain is not configured correctly.

    • Julius says:

      I actually found out the problem..and it’s been resolved…however, I am unable to add images to my library….anyone else experienced this challenge.

      • Hans Lindgren says:

        Is the wordpress install running on Windows?
        (If so, you need to grant Modify NTFS permissions to IUSR on C:WindowsTemp)

  26. Julius says:

    Awesome tutorial…however, after I attempt to log into the staging site I am taking to the “Opps! Google Chrome could not find http”. What am I doing wrong?

  27. Julius says:

    This is really a great tutorial and something I been wanting to do for quite sometime. My problem is that when I visit the WP login screen it appears that the styling from my theme isn’t applied. Is this normal? Also, when I enter my credentials from the live site into the fields for the staging site, it doesn’t log me in. It’s taking me to the “Oops! Google Chrome could not find http”. Am I doing something wrong?

  28. Sloan Stewart says:

    Very helpful article. Only issue I have is that when it begins discussing version control, it switches from focusing on the alternate wordpress installation on the server to a local installation on one’s machine.

    I am assuming one would build your site locally (I am using WAMP) and then use Git/Bitbucket & Ftploy to update your dev/staging wordpress install? That would mean one would have three versions of the wordpress site at all times [Production, Dev/Staging, Local].

    How does one ensure your local wordpress install remains compatible with the database and other configuration on the server? Or is there a way to utilize Git/Bitbucket/Ftploy on the server without having to involve a local copy of your wordpress site.

  29. Karlis says:

    Do you need to create user for your freshly created phpmyadmin database?

  30. WPBeginner Staff says:

    No this tutorial is not written for WordPress multisite.

  31. Aathi says:

    Will the above process works for wordpress multisite ?

  32. Cheryl S. says:

    Because I typically develop in a staging area on my server and then move it to the clients server to go live, rolling back to previous versions is nearly impossible. This article has made me seriously consider implementing version control with Git and Bitbucket. Thank you so much for this tutorial.

  33. WPBeginner Staff says:

    Yes this would be a better approach.

    • Mimi Bondi says:

      Thank you. Is it safe to simply copy all the files from the ”test” site and paste them over the current ”live” files via FTP? Or is there more to it?

  34. Mimi Bondi says:

    Would this be the best way to duplicate a website, set it up with a new theme/content then copy it over to the current live website?
    I want to change theme but it’s quite a big job so instead of activating it then frantically trying to fix things for days, I’m looking for a way to copy my current site, change it all ”in the background” then make the new one live. Please let me know if it’s even possible?

  35. Mimi Bondi says:

    Once i have my site exacty how i want it in the staging environment,
    is there a safeway to copy those files to the real live site?

    My goal is to change themes but because this would involve quite a bit of
    setting up, i am looking for a way to do this safely and only replace my
    current content with the new content when it’s ready (without changing
    permalinks and SEO hopefully). Is that possible?

  36. Larry says:

    Excellent article….I was able to follow the instructions step-by-step and complete the creation of development site on my hosting server. Kudos to the writter.

  37. Mike says:

    I’m having some issues when I try to run the SQL queries to change the references to the staging site. I am receiving the following error:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘1
    UPDATE wp_options SET option_value = REPLACE(option_value, ‘http://example’ at line 1

    My SQL query is as follows:

    UPDATE wp_options SET option_value = REPLACE(option_value, ‘’, ‘’);
    UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘’, ‘’);
    UPDATE wp_posts SET guid = REPLACE(guid, ‘’, ‘’);
    UPDATE wp_posts SET post_content = REPLACE(post_content, ‘’, ‘’);

    As I missing a step or do I have something incorrect in query? Thanks for your help.

    • Mike says:

      Never mind, I figured out my issue. Feel free to delete this comment.

    • WPBeginner Support says:

      You need to remove numbers from lines, replace with your live site url and with your development or staging site URL.

  38. Bevis Larsen says:

    This article is most useful for the user who want to make advance wordpress application

  39. Brad E says:

    I followed the directions and am able to get the staging site to work. However, every link, page and even login revert to the live site not the staging site. How do I fix this?

    • WPBeginner Support says:

      you need to change site address and wordpress address. To do that you need to run this SQL query in phpmyadmin for the database of your staging site:

      UPDATE wp_options SET option_value = REPLACE(option_value, ‘ORIGINAL_URL’, ‘NEW_URL’);
      UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘ORIGINAL_URL’, ‘NEW_URL’);
      UPDATE wp_posts SET guid = REPLACE(guid, ‘ORIGINAL_URL’, ‘NEW_URL’);
      UPDATE wp_posts SET post_content = REPLACE(post_content, ‘ORIGINAL_URL’, ‘NEW_URL’);

      Don’t forget to replace the original url with the url of your live site and new url with the URL of your staging site.

      • Brad E says:

        OK – it works now. I had to run the query several times, but got it to work. The problem I am having now, is that all of the theme settings are missing. The header, widgets, background, etc. are set to the theme’s defaults. I am not sure how to update the settings to what the live site has. I copied the 3 files from the wp-content directory. Thanks for the outstanding article and support.

  40. ROHIT says:


    As usual, just read you well written article on staging. I’ve got only question in mind right now and is that if there is any changes made in database while working on any project then do I need to upload it seperately on server from local environment whereas files would automatically get deployed via ftploy.

    Cheers and Thanks.
    Keep your good work up.

  41. Clive says:

    If I make changes on my local WP project, I understand files in my theme are changed, and those are uploaded to staging via BitBucket/Ftploy. What about the database/tables from my local project? I don’t understand why those aren’t also included? Or would the database/tables in staging be updated based on theme changes that are uploaded? Thanks!!

    • WPBeginner Support says:

      Clive, in your BitBucket repository you can only store your WordPress files. FTPloy simply syncs those files to your staging site.

      • Paul Sweany says:

        What do you recommend for when database changes are made? Let’s say I create a new page; should I just re-import the database on the dev server after I make changes to it on my local copy? Also, moving it from dev to live, any recommendations other than manually importing it and running a search and replace to fix the URL?

  42. Glen Clay says:

    As usual, great article and right when I need it. Keep up the great work! On another note, I am on my iPhone and that annoying floating black ‘Trending’ bar keeps getting in the way of me commenting. This article benefited me so much that I went through the several tries it took for me to comment.

  43. Eben says:

    I wasn’t really mentioned on what to do with the staging database and how to transfer the changes to the live database, especially if your client has been making changes to the live site while you’ve been making changes to the staging site and there are changes in both databases.

    This is one area of staging environments with wordpress that I haven’t been able to get my head around.

    • WPBeginner Support says:

      Staging is basically for development, when working on themes or plugins. We imported the database only so that we have actual data to test with. It is not supposed to be a synchronized mirror of your live site.

      • Juliana Maggioli says:

        I don’t know if is the same as Eben’s question, but everything is going fine till…: upload/transfer the staging content to the live site. supposing everything is perfect in the staging, how do i make all this perfect structure/content be the live site, without risks?

  44. Damien Carbery says:

    I have started using WP Migrate DB ( to convert urls and paths in the DB. It will also convert urls and paths that are in serialised data.

    So I copy the files to the staging server and create a database and then export the live db via WP Migrate DB and import it to the new database via phpMyAdmin.

    The biggest issue is when the live site is updated before I bring the staging server db back.

  45. Zimbrul says:

    If you have Softaculous is even easier to deploy a staging site to the live site: you can clone the site to a location within the same server.
    It’s what I’m doing: I create the staging environment and when done I just go the the list of my WordPress installs in Softaculous control panel and “clone” the site to the live location. The live location must be empty by other files for this to work.

  46. M Asif Rahman says:

    Thanks Syed & The Team, that’s one of the most complete and understandable for normal readers Staging Guide for WP. Nicely done.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.