Now that a rough plan is in place, it’s time to set up staging. For the purposes of this project, there was one staging environment for WordPress to live on. The rest of the development (frontend) would happen locally on my own machine.
Cloning to Staging
First, I cloned the WordPress website from production to staging. There are many ways to accomplish this. There is plugin, Duplicator, which can help make this process very easy. Or an
scp command could be used in tandem with a
mysqldump and restore.
For the sake of brevity here, I’ll skip the granular details of how to copy a WordPress website to a new location. I’d rather focus on the higher-level concepts to follow instead.
Once cloned to a staging location, I followed the following steps:
- Ensure robots.txt is blocking and search engines are discouraged
- Remove all unnecessary plugins
- Remove all unnecessary themes
Then, add new plugins to the destination installation to support Gatsby and GraphQL:
The active theme from the production site included code to register numerous custom post types and custom fields with Advanced Custom Fields. This code needed to be kept in the new backend theme, because there was lots of content depending on it.
Aside from the necessary ACF registration code, however, the bulk of the theme’s code and functions could be purged.
Tracking Theme Changes
Next, I set up a new repository in GitHub for the new backend theme, and committed the first round of code (the heavily-trimmed-back theme from the original website).
From here on out, there wasn’t too much development needed on the backend of things. Once I had the custom post types, ACF fields, and basic menu support in place, I didn’t need to fiddle much within the WordPress theme. The bulk of the remaining work needed to be done on the frontend.
Next up: Syncability
In the next article, I’ll review the challenges I encountered as well as the steps taken to keep the new WordPress installation up-to-date with the content on the production website. This development project was going to span the course of several weeks, and our marketing and SEO teams aren’t going to be holding off on their work to wait for me to finish this new website version – I had to be able to port in any changes and updates that went live, quickly.