I need to update the latest theme for my WordPress website, but worry I may lose current content.
It’s always a best practice to have any software — on your server or otherwise — up to date with the latest versions. That said, various complications can sometimes arise when you perform an upgrade to these components. Problems can range from PHP coding issues to conflicts preventing the site from loading properly.
Even at a fully managed host like ServInt, we cannot fully anticipate every conflict that might arise from updating a WordPress installation which may contain any of thousands of plugins or themes. Instead of trying to second guess what might happen, we recommend customers take a simple step to eliminate the possibility that complications arising from an update cause damage. Back up the site’s files and corresponding database(s) prior to performing these upgrades. This applies across the board, whether you’re running WordPress, Joomla, or even a fully custom site. Making a backup copy of the site ensures that, in the event the upgrade goes wrong or introduces issues, you have the resources to confidently revert the site to full functionality.
Backing up your site
In general, we recommend making a copy of the site’s public_html (aka document root), which can be done through the cPanel file manager, FTP, or SSH. We generally use SSH to copy the document root as follows:
root@vps [/home/user/]# cp -rp public_html public_html.bkup
If you are new to working on the command line and want to learn how, you can check out this article for help.
Backing up your database
When a site component is upgraded/altered, the changes are sometimes committed to a database in addition to the files within public_html. Thus, you should also make a backup of the database, known as an sql dump for MySQL.
This can be done in cPanel through phpMyAdmin > Export or via SSH:
root@vps [/home/user/]# mysqldump database_name > ./database_name.sql
Click here for more information on backing up MySQL directories.
With these backups ready to go, you can confidently proceed with the upgrades to your themes, plugins, and core installations. If you need to revert the changes, you can simply rename the active public_html to something else and rename the backup from public_html.bkup to public_html. You can then import the .sql file to the active database to restore it to its original state, done in either phpMyAdmin or SSH.
As always, if you’re a ServInt customer and you have any doubts about how to do this, just open a support ticket in your customer portal and we’ll be happy to assist you.
Photo by Matija Grguric