A step-by-step guide to set up a WordPress Staging Site

WordPress is undeniably the most consumer-friendly content platform in the current times. WordPress has numerous pre-made themes and plugins which make it a favorite among content managers and web developers.

A WordPress site is built and then taken to a production environment. The difference in the versions of the development environment and production hosting or updating a plugin or theme might cause the site to crash. This may adversely affect the search engine ranking, sales and user experience of the site. There in comes the role of the WordPress staging environments.

How to set up a staging environment?

The set-up of the staging environment should correspond to the live-production environment with the usage of the same hosting service or the same type of VPS, same configuration and same WordPress version. The staging environment has the following features: it is not available to the public and the changes made on the staging site will not affect the live site. This implies that all the codes snippets, plugins, new themes, and others can be implemented without any risks.

Setting up a WordPress staging site manually

 If you want to experiment with the custom-made modifications, you can create a staging site on the sub-domain.

  • Creation of a subdomain via cPanel

Find the Subdomains option under the cPanel and create a subdomain. Name it something which is related to staging.

  • Creation of an FTP account for the subdomain

After clicking on the FTP Accounts option, enter the new account details and ensure that the directory is identical to the document root for the subdomain.

  • Use the FTP account to upload the WordPress files to the staging site

The new FTP account can be used to upload your site’s files. Then, upgrade to the latest version of WordPress and upload it. You also need to copy three existing folders from your existing WordPress site, namely, …/wp-content/plugins, …/wp-content/themes, …/wp-content/uploads and upload them on the staging site. To speed up the procedure, you can use the cPanel’s File Manager.

  • Import/export of the database

Then, export the live site’s database and import it to the staging website. To do so, you can use a plug-in called WP Migrate DB and then activate it by going to Tools and then Migrate DB. All the file paths in the database will be automatically updated by the plugin so that they point to the new staging site URL. Next, export the database. Create a new database for the staging site. Then import all the data. Go back to the cPanel and click on the MySQL Databases option and create a new database and a database user. Next move on to PHPMyAdmin, find your new database and click Import then choose the file exported by the WP Migrate DB.

  • Edit the wp-config.php

Edit the wp-config.php file on the staging site so that you can use your new username and database. Then, log in to your staging site and restrict the access to your site and going to Settings-Reading-Discourage search engines from indexing this site.

Setting up a WordPress staging site can be very beneficial for trying out all the changes before actually implementing them live.