Backup Your WordPress (often) and Upgrade to the Latest Stable Version
Database Backup | Files Backup | Maintenance Index Page | Manual Upgrade | Automatic Upgrade from within WP
November 2013; revised September 2019
You may already have WordPress installed on your site and when you go into your administration area, you might be seeing notices that you you are using an older version and should update. Please don’t put off upgrading!! Usually, the changes have been made for security reasons.
WordPress does provide easy one-click automatic upgrading, but I like to upgrade manually. It takes a tiny bit longer, but I think it’s worth the effort, if only that it ensures you DO have a complete backup of your wordpress folder and database.
When something goes wrong one of the easiest ways of getting your site back is to restore the database from a backup and replace the files with fresh ones.
Manual Upgrade – Start by Backing Up Your Database
First, make a backup of your database (remember, you should be doing this on a regular basis even when not upgrading). To do this, go to your CPanel (http://youatcw.net/cpanel/), and click on the phpMyAdmin link in the Databases area (it may be located under “MySQL Databases). (You can also use a WordPress plugin to do a Database Backup.)
- Select the WordPress database that appears in the menu on the left. Look near the top of the right side of the page that appears and select “Export”. Make sure that the Format is “SQL”. Click on “Custom Display all possible options”
- Choose “Select All” under the tables. Check “Save Output to file”. Below Output, toggle “Zipped” in the dropdown list beside compression.
- Under Object Creation Options, Check the “Add DROP TABLE” box (so you can over-write an existing database if you need to restore it). Also make sure the “Add IF NOT EXISTS” box is checked (to prevent errors during restores if the tables are already there).
- Scroll down to the bottom of the page and click on “Go”. The database backup will downloaded to your computer.
Reference: WordPress Codex: WordPress Backups with CPanel
Backup All Files
Now that your WP database is backed up, it’s time for the second step: make a backup of ALL the files in your WordPress folder and place it in a backup folder for your computer. To do this, click on the file manager link in the “Files” section of your CPanel. (If a popup box appears, choose to open Web Root and make sure that “Show hidden files” is selected.)
- Navigate through your folders until you get to your wordpress folder. Double click on the folder icon next to the name of a folder until you can see the file names in your wordpress folder (wp-admin, wp-content and wp-includes folders and the php files such as “wp-config.php” in the wordpress root). Choose ‘Select All’ and click on ‘Compress’.
- Toggle “Zip Archive”, type in the filename you’d like and click on “Compress Files”.
- Highlight the Zip File and click on “Download”. (If you do not see the zip file, go back one directory and forward again. The zip file should appear.)
- Toggle “Save File” and click “OK”.
- Once the zip file with your wordpress backup is on your computer, please remember to delete the zip file from your site.
Thirdly, if you haven’t already, download the latest stable version of wordpress, unzip it onto your desktop.
Activate Your Maintenance Index Page
WordPress has a maintenance element built-in that is activated whenever an upgrade is being done (WP Codex: Function Reference/wp maintenance). But it is essentially a blank page containing only WP’s generic message that an upgrade is occurring.
[There is] a file in the WordPress root directory named “.maintenance”. […] The default message can be replaced by using a drop-in (maintenance.php in the wp-content directory).
You can customize this page. If you haven’t done so already, using a text editor (notepad), create your customized “maintenance” page. Put something like the following in the body of the page:
The database server for my WordPress Blog is currently under maintenance and will be available as soon as possible.
Save that file as “maintenance.php” and upload it via ASCII to the wp-content folder that is inside your wordpress folder.
Next, create another file, again using your text editor. Copy and paste the following into the new file:
<?php $upgrading = time(); ?>
Save the file as “.maintenance_disabled”. Note that there is a dot at the beginning of the file. Upload it via ASCII to the root folder of your wordpress installation (this is the same folder that wp-config.php is in).
When you are ready to upgrade, you will rename the maintenance_disabled file to .maintenance. Again, it is essential that there is a dot at the beginning of the file.
You’re now ready to do the upgrade!
- Important: Rename “.maintenance_disabled” to “.maintenance”. This way, while you are upgrading, your visitors will see your customized message that your wordpress is under construction and will be available soon.
- Delete the following from your server:
- the entire /wp-admin/ folder
- the entire /wp-includes/ folder, with the exception of any custom smilies you might have (if so, leave the /wp-includes/images/smilies/ folder intact)
- everything in the root folder EXCEPT your personal files and wp-config.php
- Important: leave /wp-content/ intact
- Upload the latest version of WordPress to your WordPress folder, making sure that images, videos, media files are uploaded via BINARY and all other files (.php, .js, .txt, .htaccess, .html, .css) are uploaded via ASCII. Please note that if you upload via the file manager in CPanel, the correct file type uploads will be done automatically.
- Next, go to “/YOURwordpressFOLDER/wp-admin/” and follow any instructions that may appear about upgrading your database. If there is no message and the administration area looks completely normal, move on to the next and last step.
- Finally, rename “.maintenance” back to “.maintenance_disabled” and your upgrading is done!
You can also upgrade from within WordPress. It’s a single click. But please ensure that you have a backup of your database and files first!
You can use a WordPress plugin to get database backups. But to backup the other WordPress files, please use CPanel.
Make sure to create a customized “maintenance.php” file and place it in your wp-content folder (scroll up to ‘manual upgrading’ for more information). This way, while you are automatically upgrading, your visitors will see your customized message that your wordpress is under construction and will be available soon.
April 2015: For security reasons, since version 3.7, WordPress has automatic updates embedded right into the coding. While it’s unlikely that updating WordPress will break your site, bad things can happen. For that reason, it’s essential that you have file and database back-ups before any updates are made. (Read more about File and Database Backups. Remember, “Save Early, Save Often!”)
If you are concerned that the automatic updates might break your site, it is possible to disable them.
If you disable automatic updates, it is imperative that you update WordPress as soon as you see the notice that an update is available.
You can use this plugin Easy Updates Manager | WordPress Plugins to disable automatic updates.
Or you can simply add the following line of code to wp-config.php:
define( 'WP_AUTO_UPDATE_CORE', false );
For more information, please take a look at the official pages on Upgrading WordPress: http://codex.wordpress.org/Upgrading_WordPress
Backup Your Website Files