How to Set up a Data Backup Process for your WordPress Membership Site

The last thing any website owner wants to deal with is lost website data. This is particularly important for a membership site, where revenue is directly generated online. Keeping up to date backups of your website’s data is not as difficult as you may think. This post covers that often overlooked but highly important topic: data backups, but more specifically:


Your WordPress database contains every post, every comment and every link you have on your blog. If your database gets erased or corrupted, you stand to lose everything you have written. There are many reasons why this could happen and not all are things you can control. With a proper backup of your WordPress database and files, you can quickly restore things back to normal.
via WordPress.org

First, ask yourself “What is my current backup process?”

If the answer to this question is “I have no idea”, you really need this post. Most people aren’t aware of their backup process (or lack of one) until they experience a devastating loss of data. You don’t want to be in that position – so put a solid process in place now.

If you have some process in place, great job! You’re probably 90% ahead of most websites we work with. But be sure to also test recovering from a backup every once in a while to make sure that your backup is actually working.

I’m interested to learn any unique insights you have about your backup process in the comments below.


What to Back Up

Your WordPress website is powered by two key components: your site’s MySQL database and the files in your site’s web folder. Both components should be backed up and both offer unique backup options.

If you store protected files or video outside of your “web root folder” or on a third party service like Amazon S3, make sure that those files are also being backed up.

Depending on the size of your website and number of plugins installed, the database and files may be over 1GB of data. If this is the case, take a look at your data and see what information could be excluded from the regular backup process. Also, make sure that you are not including your backup archives in an automated backup (this would happen if you are storing a copy of your backup in the web root folder, and the backup process includes the entire web root folder).


Where to Back Up

We advise backing up in three or more distinct places. You can store a backup on your membership site’s web server, on a totally separate web server or cloud environment, emailed to a “backups” email account, as well as local copies saved to your computer, a local server, and physically saved to external media (DVD, external hard drive, flash drive).

wp-backup-infographic


When to Back Up

Depending on how frequently you update your site, it may be important to perform a data backup on a weekly or even daily process.

Since you are running a membership site, you are managing all of the key data that synchronizes the member subscriptions from the payment gateway. Losing this data would cause a huge headache and may require you to piece together weeks or months of data manually. No thank you!

We recommend setting up a more frequent automatic backup process (daily) as well as a weekly or monthly manual backup. Pick a day, put it on your calendar, and do it. Once the process is in place it will be a quick step in your workflow providing invaluable piece of mind.


  1. Option 1: Host Backups

    Your host is (or should be) mirroring your site across a few data centers. This is one small level of data assurance but not a replacement for a true backup plan. This only insulates you from your host losing your website data, not from data corruption, a virus or malware injection, or the administrator that accidentally deletes all or some of your site data (true story).

    Depending on your web hosting company, there may be a simple way to create a data backup, either via a web tool installed in your WordPress admin, or directly within your hosting account dashboard. These one-click backups can often be downloaded or emailed to you for the local/physical backup copy I discussed above.

    It’s important to make sure that this one-click backup is including BOTH your site files and the MySQL database for your WordPress site. I suggest exploring your host’s support library or contacting them directly to better understand your backup options.

    Here are some backup processes for commonly used WordPress hosts:
    WP Engine | SiteGround | Bluehost | Pagely


  2. Option 2: Direct File Transfer + Manual Database Backup

    This requires a bit more developer experience, but the basic concept is that you are manually downloading the web server files and creating a direct backup of the MySQL database via phpMyAdmin.

    Files Backup

    Connect to your web server and simply download the entire folder via FTP. Or, if you have SSH access, you can use the command line to create a .zip backup of the entire website files on the server. We create this .zip file and name it according to the date the backup was taken. A copy of that .zip file remains on the server in a “backups” folder, and a copy of the .zip file is downloaded locally to our computer and saved to external media.

    If your web root folder is called public_html, you could use these commands to make a backup. Note that we backup * (all files) and also list .htaccess separately. Because this is a hidden file, the zip command will ignore it unless you specify it like this. If you have any special caching or rewrite rules in your .htaccess file, you will need these to restore your site 100%.

    To download the .zip file, just navigate to the folder and file name in your web browser. (i.e. http://www.YOURDOMAIN.com/backup.zip)

    Be sure to delete the backup.zip file or move it out of the web root after you download to keep others from stumbling upon it.


    Database Backup

    Access your website’s control panel or web hosting admin. From here, you should be able to access your site’s MySQL database via phpMyAdmin. (You can alternately use the Adminer plugin by Inpsyde to access your MySQL database directly through your WordPress admin.

    Click the “Export” tab. We recommend the following settings:

    phpmyadmin_export_settings

    If you database isn’t too large, you can also use the plugin WP DB Backup for an on-demand backup of your WordPress database. The backup file created by this plugin is saved in your site’s /wp-content/ folder or you can download the backup file for a local copy (we recommend doing both). Backups of large databases can be slow no matter what method you are using, but because of the way WP DB Backup works, we’ve found it to be especially slow for very large databases. You can usually just leaving it running for a while in a background tab of your browser if you find this is the case.

    Database Backup From the Command Line

    You can use the mysqldump command to create a backup of your database from the linux command line. If you grab the database name, username, and password from your wp-config.php file, you can then use the following commands.

    I have this saved as a shell script outside of my web root folder and run the script before any update or risky change to the site.


  3. Option 3: WordPress Site Backup Services

    These third-party backup services offer many features related to file backups (themes, plugins, uploads), database backup, site cloning/migration, as well as optional spam security, automated restore points, and support should you find yourself in a data-loss pickle.

    The features vary by company and price, so I’d encourage you to explore the options below when making your decision. These are some of the most widely used options available:


  4. Bonus #4: Restoring From a Backup and Testing Recovery

    If you run a website for any number of years, the chances are you are going to have to restore from a backup at some point. Stuff happens.

    But, even if your site is running flawlessly and you never have experienced a data loss, you should still test restoring from a backup to make sure that your backup is actually working.

    To restore your site, you will need both the backup of the files and the database. Exactly how to restore your site by creating a “dev” or “staging” site will depend on your specific DNS and hosting setup, but here are the rough steps.

    1. Ideally, create a subdomain for your test site, like test.mysite.com or staging.mysite.com. If you can’t create a new subdomain, you can create a subfolder on your existing site like mysite.com/test/.
    2. Create a new database for the test site. Import your database backup.
    3. Upload the zip file of your files backup to the server and then unzip them.
    4. Edit the wp-config.php file in your test site to change the database name, username, and password and any other settings that might need to be updated.
    5. Edit your .htaccess if needed.
    6. If doing a test (vs an actual restore on the same domain) use a script like searchreplacedb2 to change instances of your domain in the database to the domain of the test site.

    Special Notes on Staging Sites with Paid Memberships Pro

    Please note that staging sites are still real websites that might interact with your customers directly or indirectly. Emails initiated on your test site will get sent to real email addresses. If you cancel a PMPro membership on the staging site, your members will get an email, and PMPro will try to cancel the subscription at the gateway and/or the user’s subscription to your mailing list at Mailchimp/etc.

    Additionally, plugins like Paid Memberships Pro perform certain actions like expirations and subscription synching every night as a “WP Cron” process. If you make an exact copy of your live site to a staging site, your staging site will also run these scripts at night. It is important to disable these services using something like our PMPro Toolkit addon or disable your staging site after testing (by deleting it or maybe adding break; to the top of your .htaccess file) to keep these scripts from running. The PMPro Toolkit addon specifically stops PMPro related scripts, but other plugins may still be running scripts of their own.

    Staging sites can also be an attack vector for malware and viruses if they are left online and not updated regularly like your main site. So be sure to either delete your staging site when you are finished with it, set up a plugin like Coming Soon Page & Maintenance Mode by SeedProd, or keep it up to date like any other WordPress site.


Now go make a backup! Then, design and initiate your backup process.

The easiest first step is to choose one of the methods above and create your first backup. Once you have done that you will get a feel for how the selected method works for you, your skill set, and your workflow. There is no one “right” answer here, just the very wrong answer of doing nothing at all.

I hope that the backup process you select on easily fits within your week-to-week (or day-to-day) business. Post a comment below if you have more to add or a questions about any of the methods outlined above.

How To Have a Paid Memberships Pro level with access to EVERYTHING.

Set a hidden “super level” with access to everything. This is a useful method for site administrators to be able to easily browse their entire membership site regardless of level.


A little background…

Something that confuses some people about Paid Memberships Pro is the fact that admins DON’T have access to everything on the site. Their access is based on their membership level, just like all others users.

If you want to have a “super level” with access to everything, you can use the code below. Set up the “Membership Level” that has access to everything, set it to “hidden”, then assign it to one or more administrator/site owner accounts directly via the Users > Edit User admin.


The Code Recipe

This code recipe requires a PMPro Plus Account or higher.

View Membership Options