February 02, 2022
Hand on a whiteboard with WordPress Source Control title

Say you launch a shiny, brand new WordPress website. Sure, it’s exactly what you want today but what about in three days, three months, or even three years? Chances are that you are going to find yourself making changes to the site, whether it’s a small styling fix or something massive, like a total redesign.

That’s where WordPress source control comes into play. You may also hear it more commonly referred to as version control, as that is exactly what source control does: manage different versions of your site, sort of like snapshots that preserve the site at different points of time.

Keep reading to learn what WordPress source control is, how it works, and the options you have to consider.

What is WordPress Source Control?

A WordPress site is like any other in that it benefits from having a source control system in place. It’s the idea that you can track changes you make to your site so that you have a record of what changed as well as a way to “roll back” those changes in the event that something goes wrong.

Consider the types of changes to a WordPress site where you may want to save a previous version if needed:

  • Changing themes
  • Installing the latest WordPress version
  • Installing or removing one or more plugins
  • Creating and editing pages and posts
  • Styling changes that are applied throughout the active theme
  • Edits to a theme’s template files that affect the way content is displayed

In any of these cases, among others, source control lends an extra layer of security and assurance that your site is safe from breaking changes. And while we’ve only talked about file changes, WordPress version control is equally important when it comes to the database

What other benefits do you get with a system to version control your WordPress website?

  • Performance: Theme and plugin authors regularly include improvements, which speed up WordPress, resulting in a better user experience for your visitors.
  • Security: WordPress frequently includes security enhancements in its releases, providing you with the latest best practices and techniques for combating attacks to your site.
  • Optimized data: WordPress and plugins will sometimes clean up the way content is stored in the site’s database, keeping it organized and optimized from possible conflicts, formatting issues, and bottlenecks.

Adding Source Control to WordPress

As we’ve seen, there are different types of changes that benefit from a proper version control system. And, as you might expect, there are a number of resources for tracking different types of changes in WordPress.

  • Git repo: Creating a repository — whether it’s with GitHub, Bitbucket, or another service — where all of the site’s latest files and in-progress development can be tracked makes sure there is a centralized place to access and monitor any changes to the site’s files, whether it’s WordPress core files, theme files, or plugin files.
  • Post revisions: WordPress provides a way to access and restore changes to pages and posts built directly into the post editor.
  • Solid Backups: This premium plugin creates a complete backup of a WordPress site’s files and database, allowing you to download and save copies locally, or automatically place them somewhere else for safekeeping.
  • Staging site: Setting up an exact clone of your WordPress site provides a way to test changes to your site before deploying them to your live site. This “staging” (or “development”) site is considered a safe playground since it is inaccessible to the general public.

Let’s look at each of these different methods of WordPress source control more closely.

Creating a Git Repository for WordPress

Using Git for WordPress version control is a good idea. It not only serves as a backup for your site’s files, but it keeps track of the changes to those files. That way, there’s always a path to restore a file if a mistake is made, or it is somehow lost.

Generally speaking, Git is typically used as part of a service, like GitHub or Bitbucket, though there are many other options available. In other words, Git is software that’s integrated with WordPress rather than something that is built directly into WordPress.

See our “Introduction to Git” blog for a detailed outline of how to create and connect to a Git repository.

If you’re using GitHub to host your site’s repository, then you have an extra benefit. You can automatically deploy the changes you make to your server when the changes have been published to the repository using GitHub Actions. If you’re using Bitbucket or another service, you can still get automatic deployments using Deploybot.

Accessing WordPress Page and Post Revisions

If you’ve made changes to a page or post, WordPress stores them in your database and makes them available in the post editor.

Click on revisions in WordPress

Click the Revisions option to compare changes between revisions.

Restore this revision in WordPress

Move the range slider at the top of the screen toward the left to view past revisions, then click the “Restore This Revision” button to activate the previous revision and be taken back to the editor.

Back Up Everything With Solid Backups

Solid Backups is one of the most comprehensive and thorough methods for backing up a WordPress website. The plugin includes options to back up all of the site’s files in addition to the database, giving you a complete snapshot of your site at a specific moment in time.

Plus, the backups can be configured to run automatically on a schedule, and send the saved files and database to another location, like another directory of your server.

Create a backup with Solid Backups

Your hosting provider may also offer a backup service as part of your plan or a separate offering. Nexcess, for example, includes daily backups as part of their Managed WordPress Hosting plans as well as a built-in tool to compare the visual differences between updates.

Creating a Staging Site for WordPress

A staging site is a safe place to test changes to your WordPress site before they are deployed. We’re talking more about changes like installing WordPress updates, installing or removing plugins, or code changes to theme files. In other words, a staging site is more for changes to the code and core files rather than previewing new pages, posts, or edits to them since content changes are already stored in the database.

Many hosting services, including Nexcess, have a one-click way to set up a WordPress staging site.

Now You Know

Now that you know how there are different ways to backup a WordPress site, it’s worth taking an inventory of your site’s files, assets, and content, and making sure they are all properly backed up.

This way, you’ll never have to worry about accidentally breaking something the next time WordPress releases an update, when you change themes, if there’s a new plugin you want to try, or you simply need to go back to a previous version of a page or post.

Nexcess Makes WordPress Easy

While all of these approaches for WordPress source control are readily available, you might consider a hosting service that offers them all in a single place, like Nexcess Fully Managed WordPress Hosting.

A managed hosting solution like this is designed specifically for WordPress, meaning you get all the version control benefits we covered here, in addition to other features, like data optimization, auto-updates, free SSL certificates, and access to a content delivery network (CDN).

It’s everything you need to make your WordPress site faster, more secure, and yes, protected from critical mistakes.

Check out our WordPress hosting and WordPress ecommerce plans to get started today.

Geoff Graham
Geoff Graham

Geoff Graham is a freelance web designer and developer from Long Beach, CA. He is also the lead editor of CSS-Tricks, and teaches front-end web development at Long Beach City College.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.