What exactly is a WordPress Staging Website and How Can You Set One up?
One of the best ways to accomplish this is with the use of a WordPress staging site (also referred to as an environment for staging), which you can utilize to experiment and test large-scale modifications. So if the change that you make breaks anything -for example, installing a plugin that's not working making changes to code, editing it, or changing themes it won't affect your live site. That means you can continue to generate sales and offer an excellent experience for potential customers.
What exactly is a staging location?
Staging sites are duplicates of your live site that are hosted at a different URL (also called a test or staging URL). They're typically the last step during the process of development prior to the launch of a new site or significant changes made to an existing one. With a staging website, you can test new functions, plugins and modifications to the design, all without impacting your current site.
Your live store be able to remain up when you do something wrong, you can also take whatever time you need to test and experiment and not confuse site visitors.
Key components of a staging site
Although your staging area should be as close to the exact model of your actual location as you can, there are a few significant differences.
- The site you are using live will be located at "yourdomain.com" while your staging website would need to use a different domain name (e.g. yourdomainname.staging395312.com).
- The staging area you choose to use shouldn't be open to the public.
- Depending on how you set your staging web site depending on the configuration of your staging site, you might have to replicate manually specific features of your live environment for instance SSL certifiies, PHP versions, and various server configurations.
What kind of changes should I implement on a stage site?
If you're fixing an error or updating a price for a product or making any other minor adjustments to your site It's probably not going to make sense to transfer your live site to a staging area, making the change, then deploying it back again. Just make your minor changes on your live site and continue with your day.
Use the staging area when you make the following changes:
- Manually updating themes, plugins or WordPress core
- The addition of new plugins
- New functionality can be added to existing plugins
- The process of making major design and text adjustments to existing pages as well as post
- Redesigning your site entirely
- Switching payment gateways or making other major functionality changes
Where is a staging website located?
Stage environments are generally created by a web hosting company -- typically the same one that hosts the live website. It is possible to create a single-click staging website through your hosting provider, build one manually with a hosting provider or even use localhost on your own PC.
Here are some benefits and disadvantages of each kind of stage site:
One-click staging
Pros:
- It's quick and easy to install through your hosting company's administrative panel.
- This usually includes live deployment via one-click.
- It will automatically make a staging URL, so it doesn't require you to buy another domain to test and tinkering using subdomains or DNS.
- It's normally integrated into your hosting plan, so there are no additional expenses.
- It automatically updates root URLs in the staging site's database.
- It's easy to share with collaborators.
- Search engines are automatically disincentive from crawling web pages.
- It is secured by a http:// network connection.
Cons:
- Some hosts may use plugins for one-click staging deployments that are in are incompatible with your theme, or any other plugins you have on your site.
- It is not your responsibility to have control over what methods are employed to construct the staging area.
Stage manually on a web host
If your hosting provider doesn't provide you with one-click staging or aren't happy with the way that your host's provider set up their staging websites, you can still set up your own.
Pros:
- It is your choice the way you transfer your live site to the stage environment.
- You can choose your own test URL.
- It is possible to choose any web hosting service you like.
- It's accessible for collaborators.
Cons:
- It can take longer to set up and re-deploy to your live site.
- It is possible that you need to cover an additional host and domain registration costs.
- Your SSL certificate might not be automatically enabled on your test domain.
- It is more susceptible to errors.
- Your hosting provider may not be able for rapid deployment of a staging site to live sites. This is especially common on shared hosting plans.
- It is necessary to manually verify "Discourage websites from indexing this page" in WordPress' SettingsSettings - the Reading.
- It is necessary to turn off your staging website inaccessible for the general public by through a maintenance mode, or privacy plugin.
Staging with localhost
Localhost staging could be ideal if you're used to working on your own and do not need to collaborate with a group of developers for testing. However, it has quite some drawbacks you should keep in mind but.
Pros:
- There is no requirement to connect to the internet in order to work on or test certain aspects of your website -- you can work in the middle of a flight, while on your commute in the subway, or out camping in the middle of the desert.
- Your website may load rapidly than it does on your host, making development and testing faster.
- Your test website is private and inaccessible to anyone else by default.
- There aren't any additional fees for charges for domain registrations or hosting.
Cons:
- The initial setup of localhost can be time-consuming and is an extremely complex process. If you're trying to deploy your staging website quickly and haven't developed locally previously, this shouldn't be your first choice.
- It is more time-consuming to set up and re-deploy on your live site rather than a simple staging site.
- It is necessary to manually add an SSL certificate.
- Moving to a live website could be more vulnerable to errors.
- There is no way to test payment gateway transactions notifications emails, payment gateway transactions, or any service that is accessible via API without an internet connection.
- It's not very accessible to collaborators.
How to setup a staging site
In this part, we'll cover the process of setting up a staging website by hand, using your host as well as by using a plugin in an environment hosted by the host. The steps above should be able to translate to the creation of a staging web site using localhost. If you're new to the localhost platform, Jetpack provides an article with good suggestions for developing localhost tools.
Before you start
No matter how you set up your staging site, make sure that you have:
- A staging domain is connected to your host. Some hosting companies will let you create fresh instances of your website on test URLs that they own. Some may demand the use of your personal registered domain. If you're using a URL that you own, ensure that it's linked to the hosting account through the DNS record.
- Login details for your hosting control panel. These details are usually identical to the details for logging into your account on hosting. If you're not sure, consult with the hosting service provider.
- Secure File Transfer Protocol (SFTP) credentials. These can be found in the hosting control panel. If you're not sure where they are, you can ask the support of your hosting provider. The information you'll need include:
- Host (your live server's IP address)
- Username
- Password
- Port number
Even if you intend to use a plugin to copy your live site to a staging environment, the migration may take a while to complete. Be prepared to copy your site over manually. For this, you'll need an SFTP program like:
| Application | System | Available for free or premium |
| WinSCP | Windows | Free |
| Filezilla | Windows, Mac, Linux | Options for premium and free |
| Cyberduck | Windows, Mac | Free |
| Transmit | Mac | Premium |
This example will use Filezilla, but most SFTP clients function similar to Filezilla.
Set up the WordPress staging website with your hosting
A lot of hosting companies offer single-click staging, specifically as part of managed WordPress plans. It is the simplest way to set up the staging page since your hosting company handles most of the tasks for you. The host can also help you when you have problems.
The specific steps you'll have to follow will differ based the provider you choose, so look through their guide for all the details you'll need. For this instance we'll create the staging area using Siteground.
In your Siteground account, open the Websitestab and then click the Site Tools underneath the website you want to duplicate. Go to WordPress - Staging.
In the Select WordPress Installation dropdown, select your site to work on. Add a name for the staging site, and click on Create.

If you have files located beyond the normal WordPress setup -- e.g. the custom JavaScript -- a box appears asking you if wish to incorporate them in your staging setting. Incorporate them when they're part of your site features or designs. The exact procedure will differ for every setting. Then, click Confirm.
And that's it! It is possible to access your staging site through the same location in the control panel, and then push the changes onto your live site in a few mouse clicks.
Set up a staging website using the plugin
If your host doesn't offer staging, using a plugin to copy your current site and transfer it into a staging area is the ideal choice. Not only is it easier than the manual method as well, but it's also less time-consuming and produces fewer errors. This example will use WP Staging as the WordPress Staging plugin in this instance Other options are Jetpack, BackupBuddy, and Transferito.
The procedure of each plugin may differ If you choose to choose a different one than WP Staging, you'll want to review the manual for the plugin before you begin the process of migration. Of course, before you start anything, back up your active website!
Once you have installed and activated the plugin, go into WP Staging > Staging Sitesin your WordPress dashboard. There, you can choose the sections of your database and the files you want to include within your staging area. Everything will be selected by default, and this is the right option for the majority of sites.

Click Start Cloning now. The time required to create your staging site will differ based on the dimensions, however the plugin will keep you updated during the entire process.

When the process is finished and you're ready to go! There are instructions on how to access the staging version and log in using the same credentials that you use on your current site.
It is important to note that you'll need the Premium version of the plugin in order to move changes from staging live. However, if you aren't an experienced developer, and you don't include staging tools included in your hosting package The ease of use is likely to be well worthwhile.
The process of setting up the WordPress stage site by hand
The following steps are based on a host that uses cPanel. If your host uses an alternative like Plesk or an alternative control panel, these steps are likely to be the same. If you're not sure it's possible to find assistance in your host's help documents or by reaching out directly to their customer service team.
Step 1: Make backups of your current website.
Make one backup of your current website before beginning to copy your staging site in case something goes wrong.
2. Copy the file from your live server onto your desktop
It is necessary to have an SFTP client along with login passwords. If you're not certain what these are, ask your hosting provider.
- Log in to your web server using your SFTP client. Use the credentials supplied to you by your hosting provider in the Host, Password, Username, Password, and Port fields.

- Browse to the folder on your PC in which you wish to download your website's content. In most SFTP clients, local file downloads appear on the left pane, while servers from external sources appear on the right.

- Open the directory public within your website server (right pane) . This folder is usually called ' public_html" or " http://www. The directory name can vary but you should make sure to check with the hosting company if you're unsure.

- Choose all the files in the right pane, and then drag them into on the left. This could take a long time depending on how many files you've got and the connectivity speed.

Step 3: Export your live site's database
After you've transferred your files from your live server to your desktop, you'll be required to export your database and import it to your staging system. If you attempt to go to your staging URL before importing the database you will see the error message: 'Error establishing database connection.'

Unlike your WordPress databases, your database can't be access via SFTP as well as the cPanel file manager. For accessing and exporting your database, you'll use the phpMyAdmin. It is available in phpMyAdmin in the cPanel section under the Databases section..

In phpMyAdmin:
- Select your database.
- Click the Export tab.
- Choose Quick for the method of export Choose SQL to be the type of file, and then Click Go.

It will then transfer a .sql file onto your PC. Make note of the location this is saved, as you'll be required to install it to your staging web server.
Step 4: Transfer your live site's database onto your staging server
For you to transfer your live site's database, first you'll need to build a completely new unpopulated database on the staging server.
- Within your control panel for hosting visit the "Databases' section and click MySQL databases..
- Create a new database. In this case, the database will be called 'tutorial_mydb.'

- Create a database user. Within the MySQL Users section you'll start a new user. Use your own unique user name (not "admin" --Get inventive) and use a strong password.

- Add the database to the user. In the Add user to database section, click on the user and the database that you created earlier, and then press "Add".

5. Give all rights to the user account , then Click to make changes.

Voila! You've successfully created a blank database into which you can connect your live website's database.
5. Make changes to the wp-config.php file
The wp-config.php file contains important information about your database. The file links WordPress to important data such as posts' content, meta information for post users, post meta and plugin settings. The wp-config.php file must be updated with your staging server's information about the database to ensure that the new staging website is able to communicate with your database.
- In your personal computer, locate the backup of your wp-config.php file that you downloaded from your live site. Open it up in an editor for text you prefer, such as the VS Code or Notepad++.
- Go to the mySQL area of the file and replace your database's details from your live website by the ones you created.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'yournewdatabasename' ); /** MySQL database username */ define( 'DB_USER', 'yournewdatabaseuser'); /** MySQL database password */ define( 'DB_PASSWORD', 'yournewdatabasepassword' );
A few wp-config.php files contain also the following line:
define('WP_SITEURL', 'https://yoURLivesite.com'); define('WP_HOME', 'http://yoURLivesite.com');If you notice these lines in your file, you'll need to change these lines to the URL of the staging server.
- Save your wp-config.php file and replace it with the one you uploaded to your server's web page by dragging and dropping it over with an SFTP client.
Step 6: Import your live site's database
- Log into the phpMyAdmin page from your website server. In cPanel there's a section called the Databases section..
- Select your newly created database and then select on the Import tab.
- Click Select File to open the sql file that was previously exported.

4. Click on the Go button to begin the import process. Depending on the size of your database, it might take a little time to transfer. After the import has been completed then you will find all the tables in your database in the upper left.
Step 7: Modify the root URLs in your site's database
Once your information is imported, you'll need to replace all instances of your live site's URL with your new staging site URL.
- Open phpMyAdmin and choose your database.
- Go to the wp_options table. Tables are usually displayed in the lower left.

3. When you open the program, you'll have the option to select the top two choices. Look under the option_name column for labels websiteURL and home.
4. Double click on the siteurl as well as the home option value beneath the option_values column and change both to match your stage URL. Make sure you don't add a forward slash (/) to the right of the URL.

5. Start your browser, and enter your staging website's URL with /wp-adminor in the last (e.g. https://yourstagingsite.com/wp-admin/). This will direct your to the sign-in screen.
Step 8: Flush your web-based permalinks
Permalinks are the permanent URLs for pages and posts on your website and their underlying design. Sometime, your page and post hyperlinks won't work properly on your staging site unless you clean your permalinks prior to flushing them. It's a straightforward process.
- In your staging site's WordPress dashboard go to Settings and then Permalinks.
- Click Save Changes. There shouldn't be any need to alter something in the setting.

Step 9: Search and change your live website's URLs in your database
The site you're working on probably has at least a few self-referencing links that use the URL of your root. If you have a staging website, you don't want those link to refer to your live version, and it's necessary to search and then replace. The safest and most efficient way to do this is with the help of a plugin. In this case, we're employing Better Search Replace. Better Search replace plugin.
Be aware that before you do anything on your database, make sure to create backups.
In your WordPress dashboard:
- Go to the Plugins section and add a new plugin.
- Search for Better Search Replace.
- Select Install Now and activate.
- In the dashboard of your WordPress dashboard, go to Tools - Better Search Find and Replace.
- Fill in the search forfield by entering your live website URL (e.g. livesite.com).
- Fill the Replace with field with your web server URL (e.g. stagingsite.com).
- Select the database tables that you want to perform the search/replace on. It is usually only necessary to apply this to the wp_posts as well as the the wp_postmeta tables.
- Check the run as dry?.
- Click Run Search/Replace. Dry run indicates it will not make any changesbut will show you the number of modifications that are created when you actually run the search and replace.
- Examine for changes. If the dry run has been done, you'll see a number of changes. If you don't, then it's possible that you need to check the URLs. If you're sure that your URLs are valid but there's nothing else to be changed, then you don't have to do anything further and you can remove the plugin.
- If you are looking for changes you want to make, de-check the Dry run? option and click Run Replace/Search.
- Uninstall and disable Better Search replace. Once your search and replace has been completed and you've checked whether the website is functioning properly, you are able to deactivate and uninstall the plugin.
Pause and enjoy your cup of coffee. You've completed the manual staging setup and can now begin testing, troubleshooting and testing!
Test your staging site for errors
However you decide to employ to create your staging site You should be testing it in order to ensure that there's nothing amiss during the setup process and then run it through again after making your adjustments and upgrades. The things you'll need to check will differ from one website to site, however here's a checklist of some questions to ask in the process of testing
Front-end:
- Does the site display as expected on both mobile and desktop?
- Does every link work?
- Are interactive elements functioning properly (e.g. carousels, buttons, accordions, pop-ups)?
- Can you submit form? Are the submissions received?
- Are the Cart and Checkout pages work properly?
WordPress dashboard:
- Do your dashboard pages load correctly?
- Can you add and edit pages, posts, or items?
- Can your website be indexed through search engine crawlers? Go to Settings - Reading and make sure you block search engines from indexing your site is not checked.
- Are your plugins and themes working? pages and settings function?
- Can you install new plugins?
Secure your website and prevent downtime
No matter which option you select, test out any major updates and changes on your site using a staging environment instead of directly testing your live website. This will help ensure that your live website is protected from the pitfalls of the latest plugins, avoid delays due to errors or conflicts, and ensure that your visitors enjoy an uninterrupted and seamless users experience.