How to backup and restore a WordPress website, focusing on creating a manual backup via an XML export and performing a complete backup of files and databases.
Following this guide will help you secure your data and easily restore it to the same or a new WordPress installation when needed.
Step 1: Backing Up Your WordPress Site
A. Exporting Content to an XML File
- Log into Your WordPress Dashboard: Go to your WordPress admin area.
- Navigate to Tools > Export: Here, you’ll find the option to export various types of content.
- Select Content to Export:
- Choose “All Content” if you want to back up everything—posts, pages, comments, custom fields, categories, and tags.
- You can also export specific content like just pages or posts, if you prefer.
- Click on “Download Export File”: This will generate an XML file, called WordPress eXtended RSS (WXR), containing the selected content.
- Save the XML File: Store it in a safe location on your computer or a secure cloud drive. You can use this file to import your content to another WordPress site if needed.
Note: This XML backup does not include themes, plugins, or media files. For a full backup, proceed with the following steps.
B. Backing Up Database and Site Files
For a complete backup of your WordPress website, including all media files, themes, plugins, and settings, it’s essential to back up the database and files as well. Here are two common methods:
- Using a Backup Plugin
- Popular plugins like UpdraftPlus, Duplicator, or All-in-One WP Migration allow you to schedule regular backups, including databases, media, themes, and plugins.
- Steps:
- Install and activate a backup plugin.
- Go to the plugin settings, choose what to back up, and run a manual backup.
- Download the backup files to your local system or a cloud storage service for safekeeping.
- Manual Backup via cPanel or FTP
- Download WordPress Files:
- Use FTP (e.g., FileZilla) to connect to your site’s server, or use File Manager in your hosting cPanel.
- Go to the root directory (usually
public_html
orwww
) and download all files, including thewp-content
folder,.htaccess
, andwp-config.php
.
- Export Database:
- In cPanel, go to phpMyAdmin.
- Select your site’s database, click Export, choose the “Quick” export method, and save the
.sql
file.
- Download WordPress Files:
Step 2: Restoring Your WordPress Site
A. Restoring Content from an XML File
- Log into the New or Existing WordPress Site where you want to restore the content.
- Navigate to Tools > Import: This section includes various import options.
- Choose “WordPress”: You may need to install the WordPress Importer plugin if it’s not already installed.
- Upload the XML File: Click on “Choose File,” select the XML file you downloaded during the export, and click “Upload file and import.”
- Assign Authors: You’ll be prompted to assign the content to an existing author or create a new one.
- Import Attachments: Check the box to “Download and import file attachments” if you’d like to include media files.
B. Restoring a Complete Backup
If you’re restoring the entire website, including themes, plugins, and the database:
- Restore WordPress Files via FTP or cPanel
- Upload Files: Use FTP or File Manager to upload all backed-up files to the root directory.
- Replace wp-content: Ensure the
wp-content
folder is correctly uploaded to retain all plugins, themes, and media.
- Import Database via phpMyAdmin
- Open phpMyAdmin: Go to phpMyAdmin in your hosting cPanel.
- Import Database:
- Select the database associated with your WordPress installation.
- Click on Import, choose the
.sql
file from your backup, and click Go to complete the upload.
- Edit
wp-config.php
(if necessary): Ensure the database name, username, and password match the new database settings if you are restoring to a different site or server.
Tip: It’s a good idea to keep a few recent backups saved securely. Always test your site after a restoration to ensure everything is working properly.
Leave a Reply
You must be logged in to post a comment.