Wednesday, April 6, 2016

How to edit a WordPress website offline on your Windows desktop using WAMP

In my previous post I covered the installation of WordPress with WAMP. This is a follow-on for the the below post:
How to install WordPress locally on your Windows desktop using WAMP

Now that I have wampserver and WordPress installed and running on my desktop it's now time to import the site so I can work on it. Once again I have another gripe with the WordPress documentation - There isn't enough detail as usual. How to move your WordPress site to edit it offline should be discussed in the "Moving WordPress" section of their Codex but it's so generic it verges on unhelpful. With this post I aim to help anyone in a similar situation to me. 

Backing up your WordPress site
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. While I could go through the process of doing everything manually, I decided to make use of the various plugins available in WordPress. I started with "UpdraftPlus - Backup/Restore" but in order to make use of migrate and export options I needed to buy another plugin for that plugin - Yeah, not happening. Next up I decided to take a look at a plugin named "Backup Guard" which seems to work great so far.

First off I installed BackupGuard on the production site. After installation there is a new entry in the sidebar for "Backup Guard". Clicking on the backup guard entry will bring you to the following GUI where you can complete a backup or import a previous backup. I performed a manual backup and you can see it completed successfully:

Here is where I encountered my first problem. When I clicked the download button it simply opened my website, rather than actually downloading anything. Right click the save logo and choosing save target just gave me an error stating no file. I'm not sure if this would have worked in another browser or not but I just decided to use SFTP instead and transferred the backup (sg_backup_20160406201153.sgbp) to my local desktop. Swapping over to the offline instance of WordPress I tried to import the backup, however it told me the file was too large (67MB) but offered me an alternative.

If your file is larger than 2MB you can copy it inside the following folder and it will be automatically detected: C:\WAMP\www\wordpress\wp-content\uploads\backup-guard

Please note your directory may be different depending where you installed WordPress. So I did just that; Copied my sgbp file to the above folder and it appeared once I returned to the backup guard section again. Now I just needed to click the restore button and hope everything went to plan:
This process took approximately a minute or so and then I was brought back to the login prompt again. First I felt a little panicky because my credentials I setup in the previous installation were not being accepted. Then I realised my mistake; The credentials being requested were those of my live website rather than the offline instance. The import was a success! 

Much easier than I expected..

No comments:

Post a Comment