Creating a Test Site
Creating a test site is very beneficial as you can learn how bbPress and WordPress work, and to also test them both out.
- For a developers creating a test site could help them develop plugins or themes for bbPress.
- For the common WordPress site tweaker it can test simple style or functionality changes on their test site before transferring the changes to their live site.
- More importantly creating a test site will allow you to test plugin/theme upgrades for issues so that an update does not leave your live site vulnerable to hackers or break your site.
This simple process should help you upgrade with confidence, and can play with your site more boldly, testing everything in the test site first, and only committing to a live site once you are satisfied that everything is in a working order.
If you are not convinced that you need a test site, then read my reasoning here: Why have a Test Site?
There are two popular choices for creating a test site:
- Installing a local server environment client on your computer
- Using a subdomain of an existing domain.
Creating a test site on your computer is a good and free alternative to purchasing a new domain. If you want to go this route, you’ll need to install an application that supports your operating system and will allow you to run software that a host server usually has installed to run the test site on your computer.
Each application identifies itself by the operating system it supports and installs software that includes, Apache , MySQL and PHP (XAMPP also includes Perl). Below is a list of popular local server environment clients and also links to guides that are part of the WordPress Handbook to help you install each application.
The most popular local server packages are:
After creating your test site and installing WordPress on your computer using one of the listed software applications, you can install bbPress and test it out. You can see how plugins work with bbPress, themes work, and you can also develop plugins or themes for bbPress.
A subdomain uses your primary domain as a separate site. So if you create a subdomain of say “test” then you would use “test.mysite.com” as the URL to access this site.
Most host providers allow you to create subdomains. If you access your hosting area, you should find an option to create subdomains. How to do this varies with host provider, so if you need any help contact your hosting provider’s support for any information on how to create a subdomain for your current setup.
Once created, you can then create your test site and receive the benefits to:
- Test any performance issues
- Test plugins that include APIs to external sources
Cloning or mirroring your live site allows you to test any modifications/upgrades on a test site first without affecting your existing live site.
So can you can test:
- new upgrades to themes and plugins
- add and test any new plugins
- alter installed WordPress themes
- add css, alter functions, layouts, and anything to do with your existing WordPress site
So you will commit only in the test area first, and if you are happy with the results you may then transfer those changes to your live site. And also if a plugin has a new upgrade, you can test the upgrade on your test site first, if the upgrade caused an issue you will know not to upgrade on your live site until the issue is resolved.
Copying the Data
So now you have a testing domain with all the files and folders that you live site has, but you need to copy the data.
To do this
- Use phpMyAdmin to access your live site’s database.
- Next, on the left, you’ll see all of your created databases.
- Find and select your Live Site’s Database, and you will now be shown a series of tables.from that database.
- You’ll see an option to Export in the menu at the top. After clicking it , you’ll be presented with some options.
- Now you can do a quick export, but this is not recommended in my opinion, I prefer you to do a Custom Export to allow you to compress the data into zip format and add any additional values to improve restoration.
- So now enable Custom.
- Normally you can just export the database in a single package , but if you have a particularly large database, you may not be able to export/import in one go. You may have to copy a single database table or group the tables during importation. However, you may try exporting all of your tables first to test and assure that everything is working fine.
- In the Output section, select the zip format of your choice to compress your database data. This may noticeably increase the upload time for larger databases. It can also allow you to overcome some file upload size limits that your host provider may set.
- In the object creation options , enable Add DROP TABLE/VIEW /PROCEDURE/FUNCTION/EVENT statement. During the import process, this will delete any existing tables before restoring the new ones, ensuring a clean importation.
- Now click Go, and the file will download onto your computer.
Importing the Data
Having already downloaded the database data in a compressed file format, you can now Import the data into a new or existing database.
If you haven’t created a new database.
- Go to the phpMyAdmin home page.
- Click the Databases menu item at the top
- You will now see an area to create a new database and also a text input to name your database.
- Create a new name for your new database for your test site. Leave the drop-down as the default setting of Collation, and click the Create button.
- You just made your new database.
To Import your data into your new database.
- Select your recently created database for your test site.
- Click the Import menu item at the top
- Now click the Choose File button , then select your live site’s database data from your downloads.
- Click the Go button. Wait for the import to finalize, then after all that you should see a success message.
- Now you have imported your live site’s database data to your test sites database.
Change the Site References
Since the live site’s data has been imported into the test database, you will see the urls of your live site in the wp_options table. If you don’t change these you’ll be re-directed to your live site, so it is key that you change this.
- In phpmyadmin select your test site database
- Click the SQL menu item at the very top
- Now in the empty box enter the following SQL code
UPDATE wp_options SET option_value = REPLACE(option_value, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_posts SET guid = REPLACE(guid, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_posts SET post_content = REPLACE(post_content, 'LIVESITE_URL', 'TESTSITE_URL');
TESTSITE_URL is your test site’s full url address.
LIVESITE_URL is your live site’s full url address.
And you can change the wp_ prefix if you are using something different for your test site’s database.
Once you have finished creating your test site’s database, you’ll need to install WordPress. This will allow you to input your new databases information during the install. You may do this manually or using your host’s provided installation process for WordPress.
- First Download a copy of your live site’s wp-content folder using an FTP or SFTP client.
- Then Upload the folder’s content that you downloaded, to your test site’s wp-content folder. All important files such as themes, plugins, and media uploads will be transferred doing this.
After you set up your test site you need to disable access for users and search bots from indexing your test site.
- In Dashboard > Settings > Reading change the search engine visibility to discourage search engines from indexing your test site. And just keeping any SEO plugins/functionality disabled should help.
- Since this is a test site , you would not allow anyone to be able to register to your site. So installing Restrict Site Access , would allow you to restrict the site only to your IP address, and allow only you to access your test site.