Customer Accidental Situation:
Last year I was building a WordPress site for a freelance project. When I was ready to share my progress with the client, I got my staging site up so they could see the progress I had made so far.
As I was distracted, moving things around in my FTP, I accidentally deleted several important theme files. It took me a few minutes to even realize what I had done. But once I did, my heart jumped out of my chest.
Did I seriously just accidentally delete a quarter of the theme files?
Cue the Macaulay Culkin scream.
It took me a few moments to remember that I could somewhat easily restore a version of the site from earlier that day. Sure, not all the changes I had made just before were brought over, but at least it was something.
Just like saving work when you’re writing a paper, or preparing an important report for work, it is important to save copies of your website. As it’s called in the tech world, you always want to have a “backup.”
Having a plan in place to back up your site is absolutely critical for anyone and everyone who has a website – from the least-techie beginners to full-stack lead developers. Trust me, you’ll save yourself from so much heartache if you read and follow along!
In this article I’ll be covering:
- What it means to back up your whole site
- Prevention measures, so you can avoid using those backups
- Why backing up without a plugin is better than with a plugin
- Different ways you can back up your site: automatic, manual, and other options
- Why you should never put all your eggs in one basket, or rely on only one backup method
What is “backing up”?
Backing up, plain and simple, is saving a duplicate version of all your work. This includes your website theme and related site files (like plugins) as well as your database (which includes posts, users, comments, etc.).
Backing up is similar to how you might save an important document to your Google Drive or Dropbox and to your desktop. It’s always wise to save important items more than once and in more than one place, or “medium” (like an external hard drive, thumb drive, the “cloud”, on your computer, and so forth.)
Your website is no exception.
Backing up is great: but make sure to put prevention measures in place, too
Before talking more about backing up, realize that prevention measures can and should be put in place to keep your site safe and secure.
- Updating plugins and themes
- Using strong username and password combinations (i.e. not “admin” and “password”)
- Creating strong database table prefixes (AKA not using basic the common “wp”)
But even when you’re safe and implement all the right security measures: things can always go wrong.
That’s why having a backup system for your WordPress site(s) is important.
This article discusses the different ways you can do just that—but without a plugin.
Wait…Why not use a WordPress plugin!?
For those unfamiliar with all the aspects of WordPress,plugins allow you to add onto the functionality that already exists with WordPress sites.
While you can create your own plugin, there are many plugins that already exist that you can download and use on your site. (At the time of writing, over 37,000 are available to download!) There are lots of backup plugins out there. Some are good, some are better. Some are free, and some cost money.
There is nothing wrong with using a trusted backup plugin like BackupBuddy. However, backing up is best done at the server level—not the site level.
Think about it: a plugin, doing automatic backups of your (perhaps) very large site, is like extra weight on your server. Every time it does a backup (which could be daily), it’s doing “work”—which could slow down your site among other things.
Also, in my professional opinion, the fewer plugins on your WordPress site, the better.
While some may disagree, from my perspective, the more control you have over your site and its innerworkings, the better. It’s smart to rely on yourself rather than a 3rd party—especially when it comes to backing up your treasured site files.
- Certain plugins can slow down your site (because they take up space…some a lot more than others)
- Mo’ plugins, mo’ vulnerable (think about it: plugins are 3rd party. While some are very high quality, others may not be updated regularly. As a result, they can make your site more insecure.)
Now, I am not saying you should forgo plugins all together. I love some of mine and use them all the time. But do be aware of some of the downsides to amassing large quantities of plugins. And almost all would agree that it’s best practice to keep 3rd party plugins up to date and delete any you are not using.
2 Different Types of Backups
Before diving into the different ways you can back up your site without a plugin, let’s talk about what you can and should back up: site files and databases.
Your WordPress Site Files
Your WordPress site is composed of various files. According to the WordPress documentation, your WordPress website consists of these six components, in one way or another:
- WordPress Core Installation: the files you get when you download WordPress (pictured below)
- WordPress Plugins: as explained above, added functionality to a site via PHP scripts, found in the wp-content folder
- WordPress Themes: allow you to customize look and certain kinds of functionality of site, also found in wp-content folder
- Images and Files: different images and files added for admin panel as well as site itself
- Additional Files and Static Web Pages: anything else you might add
When building WordPress sites, you really don’t tinker with much beyond WordPress Plugins and Themes. (Both found in the wp-content directory.) However, it is still wise to backup ALL parts of your site so you don’t end up trying to restore only part of your site, or worse—trying to figure out which part of your site is missing so you can piece it back together! Backing up the entire site makes it way easier to restore if something does go wrong.
For a more in-depth look at WordPress files, look to the WordPress Codex.
Realize that when you do backups at the server level, most hosts will back up your site files, too. However, it can take awhile to restore all these files from your server if your site were to go down. And obviously you want to get things up and running again as fast as possible.
Plus, it’s always good to have an additional copy. As I talk about later: it’s never smart to have all your eggs in one basket.
You can easily back up, or copy, these site files from your FTP. (This is a backup method I frequently rely on.)
However, there are also other software tools available, like WinSCP, that make mirror copies of site files and save them on your desktop—which can save you time.
And then for more advanced users using the WP-CLI command line interface, backing up site files can be done from the command line and saved to your computer.
And of course, you can usually make backup copies of site files right from your server.
As you can see, there are multiple ways you can back up your website files. What matters most is that you are backing up your WordPress site files.
Your WordPress Database
Backing up your site files alone is not enough, though.
Your site files do not contain all your website information (like blog posts and pages). To have a complete replica of your site, you also need to back up your MySQL database.
The MySQL database is where all of our WordPress data lives. Data like:
- Categories and tags (taxonomies)
- And so on
Looking back to my post, How to Install WordPress on Your Mac Using MAMP, where I set up a fresh WordPress site locally with a database named “saief_db”, you can see the database tables that WordPress comes with.
Over time, you can acquire more tables. (Depending on plugins used and other types of functionality added.)
These tables hold certain site contents. For example, this is what the skillcrush_db posts table looks like.
As you can see, there are only two published posts. (Both of which came with the fresh WP install.)
Of course, a larger site with lots of posts and pages will have many more entries.
The point is: you want to back up your MySQL database along with your website files.
Both of these together, site files and your database, make up your entire site. One without the other is not your full site.
If you back up your files alone, it will just be an empty theme: no posts, no pages, no added media library images. If you back up your database alone, you will have content (the posts, the pages, etc.), but you will not have a theme, or appearance and functionality.
Different Ways of Backing Up Your Site Without a Plugin
Now, let’s talk about how you can back up website files and databases without relying on a plugin. The following section is broken down into three types of backups: automatic, manual and other.
Automatic WordPress Backups
Automatic backups of your WordPress site are just as they sound: automatic. They happen on their own, without you having to do anything.
Aside from plugins and other more advanced CLI tools that do this, automatic backups can also be done at the server level.
Most legitimate WordPress-friendly hosts offer automatic backups as part of their service, or for a small additional fee.
For instance, my WordPress host, Bluehost, has automatic backups that come with the hosting service at no extra cost. They also have a “Backup Pro” add-on service (for an additional fee) that gives more features and makes backing up and restoring more convenient.
Again, this is standard for most WordPress friendly hosts.
And if you decide to use a more premium hosting service, like WP Engine, backup and restore features will be more feature-rich.
Note: your host should keep your automatic backups on a separate server than the one your website lives on. Because if your site server is hacked, and your backups are stored on there, they will not survive. If you aren’t sure, make sure to contact customer service or tech support to find out.
And like anything, generally the more you pay, the better quality and service you receive. The same goes with automatic backups at the server level.
But of course, even high quality automatic backups at the server level are not foolproof. When I say “high quality”, I mean backups that are done regularly, stored on a separate server, and have other security measures in place.
I think we all should know by now that when storing data online, nothing is ever “safe”. (Think “Celebgate”, the Target attack where data was stolen from over 70 million shoppers, the Home Depot cyber attack where 56 million payment credit cards put at risk, and so on.)
As secure as your automatic backup may be, don’t solely rely on it. Bad things can always happen…even if we put the appropriate prevention measures in place.
While automatic backups on the server-level are awesome and convenient, you want other copies of your site saved in different places.
Here are a few ways to do manual backups of your site files and databases.
1.Through Your Host
This way is probably the simplest.
You can manually back up your entire site through your cPanel. (By the way, this article has helpful step-by-step instructions on how to do this. The author later shows how to restore backups, too.)
Depending on your host, your cPanel could look a bit different.
On mine, Bluehost, you have the option of backing up:
- Website files: Your public_html directory, which is the root for your primary domain
- Home directory: Contains public_html directory along with other directories for your mail, FTP setups, etc.
- MySQL databases: Database(s) only their corresponding tables only, not website files
- Full cPanel Backup: As the image below shows, this backs up your entire account. So if you have more than one site on your account (like I do), it will back up all files, settings, DBs, etc. for every one.
You can also restore emails if you created email addresses on your server.
Downloading a backup is as easy as clicking the download button. And then a zip or tar file download appears. (Note: backing up entire MySQL databases and full cPanel’s, especially if you have multiple sites like I do, can take 5-10 minutes. Maybe even longer.)
You can then save these files to your computer, iCloud, external hard drive, thumb drive, etc. for safe keeping.
- Backup Through phpMyAdmin
Aside from backing up in your cPanel, you can also back up your databases through phpMyAdmin, which is accessible through your server. (This is the same thing from the MAMP article, except you’ll be on a live site instead of local site.)
Backing up my live site from the phpMyAdmin dashboard is not my preferred method because I do not like going into the live database for my site(s). However, you can read more about backing up via phpMyAdmin here.
(It is simply done through the “Export” tab.)
Exporting site data with built in export
There are other ways you can save all your site data, like with the free WP export. It’s simple to do this from your admin panel.
However, realize that WP exports do not export your theme, plugins, and other important website files.
It is then easy to import this data on another WordPress site.
You can also use your FTP to make a backup using Cyberduck or Filezilla.
It’s as easy as downloading the files you want to save.
Right click the files you want to save, then select “download.” Below you can see my theme on my live WordPress site in Cyberduck FTP.
Advanced and automated FTP backups
Only advanced users should use this method of backup. Basically, you can use a script that backs up “both the database and files of a WordPress blog into a remote FTP server (while keeping a local copy).”
WP CLI (advanced)
The WP CLI is also a more advanced WordPress tool.
It is for people already comfortable using the command line. You can do different things all from the command that you would normally do in an admin panel: download plugins, manage user capabilities, manage sidebars, perform database operations, etc.
Now, how often should you do a manual backup?
That really depends on how frequently you update your site, both in terms of the site content and the design and functionality.
Personally, on my most active site, saiefmahmud.com, I try to do a manual backup once a month. (Of both my database and website files.)
On the other hand for my laurencebradford.com site, where I haven’t written a new blog post in over a year, I haven’t made a manual backup since August 2014.
Why? Because the site has basically not changed since then. And if it were to go down, and I couldn’t restore it on the server level from an automatic backup, I would be OK with restoring it back to the August version.
But my learntocodewith.me site? Going back to an August version would be catastrophic. I don’t even want to think about it: it makes me nauseous. The thought of losing all that work… I actually stopped writing this sentence just to do another manual back up of all my site files and my database.
Anyway, that’s why I back up that site manually more often: it is updated much more regularly and is of higher importance to me.
How many backups should I keep around?
This really depends on you and your site.
I generally keep 1-2 of the most recent full site (site files + database) backups on my computer, and on Dropbox. (And, of course, my server does automatic backups.)
No need to save every back up in history! (That would take up a ton of space on your computer/external hard drive, too.)
This is especially true if you have updated the site significantly since, and do not ever plan on returning to the older versions.
Sometimes if I am redoing a site, I will make more periodic theme-only backups (so, not the database). Just as a way to double-save my work.
When it Comes to Backups: Don’t Put All Your Eggs in One Basket
Similar to investing: you wouldn’t put all your savings into a single mutual fund. Because if it tanks, you’re in some serious trouble.
The same line of reasoning can be applied to backing up your website files and databases.
Don’t just back up on the server level. In fact, WordPress recommends keeping three different backup copies — all in different mediums (so CD, hard drive, desktop, cloud, etc).
For my most important sites (which is really just one…) I maintain a recent database version locally (on my MAMP).
I also do periodic theme and full DB backups (about once a month) locally on my desktop… saved in a special folder, which then syncs to dropbox. (Again, I only do frequent manual backups of the site, since it’s my most important!)
In the end, always make sure to backup your work! It might take a little time or effort to set up, but think of the headache, anxiety, and working hours you’ll save by keeping a code apocalypse at bay.
If you have more questions about backing up your WordPress site without a plugin, feel free to email at email@example.com and he’ll try to help as best he can.