This tutorial assumes you have some prior knowledge of PHPmyAdmin, adding Domains, and copying files.
How-to Create a WP Staging Website:
1. First thing you need to do is to create a subdomain (subdomain.example.com). This allows your staging website to run in a separate folder, not affecting your main website files.
2.Now that you have setup your subdomain, the next step is to copy the database from your live site to your staging site.
Log into phpMyAdmin, and select your current live database, clicking on the Operations tab in the menu bar.
In the Copy Database To box, enter the name of your staging database (if you haven’t created it yet, click “CREATE DATABASE before copying”). Click Go to run the copy, this could take longer on larger databases.
3. After your database has copied, you need to select it from the sidebar on the left and rename the URLs in the database. To do this, click on the SQL tab in the menu bar and add the code below to Run SQL queries.
Remember to update the URL value: NEW_URL = staging.example.com, ORIGINAL_URL = example.com
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');
4. After copying your database, you need to copy your WordPress files to the staging server.
5. After copying your data, update your wp-config.php file to use your new staging database connection details. You can use FTP to accomplish this, or if you are an expert, you can use Terminal:
cp -a /PATH/TO/INSTALL /PATH/TO/STAGING
6. Remember to add a disallow all to your robots.txt, and/or update your Search Engine Visibility settings or you might be penalized with duplicate content.
Settings > Reading > Search Engine Visibility
Click “Discourage search engines from indexing this site”
Full Stack Developer, Digital Marketer, and InfoSec enthusiast. He received his Bachelor’s Degree from the University of Western Sydney and his Business Diploma from Georgian College before joining various marketing positions in search portals, e-commerce, higher education, and addiction recovery services.Follow @ twitter
Add a shortcode to add_shortcode in functions.php
This drove me a little crazy one afternoon. I had to add a gravity forms shortcode to a new add_shortcode script in functions.php To accomplish this, I added this to my code: ‘ . do_shortcode($content) . ‘ Here is how it looks in its working example. I work best by watching. Too many people just… Read More
WP Child Themes
WordPress child themes are really simple to make, but I’ve noticed most tutorials are more complicated then they need to be. All you need are two files in a folder: style.css + functions.php Style.css Replace Template: twentyseventeen with the name of your parent theme (it will be the folder name): function.php If you notice the… Read More