Maintain a WordPress Website
Although your WordPress (WP) website is running just fine, there will be time when you decide to update or make changes to it. You want to make a copy of your WP website, working and experimenting with it locally. When you have satisfied with the changes, then upload the new version to replace the old one. Below are the summary of the steps:
A. Backup the WP website database to the local computer.
B. If you have not installed XAMPP, get one. [I prefer XAMPP over WampServer, but any combination of Apache Server, MySQL, and PHP should get the job done].
C. Download and install: (1) WP and put it into the XAMPP htdocs directory, and (2) Development tool, fancy like Dreamweaver or simple one like NotePad will do the job. I am using DW.
D. Time to work, you might update, experiment, and test new version of WP, plugins, themes, components or design elements. Then using FTP (FileZilla is my preference) to transfer new changes overriding the one ones.
To make it clear and avoid common mistakes, the details are explained as following:
A. Backup (Export) WP DB by using phpMyAdmin:
* Do not include the information_schema because it will cause troubles later
* Choose a specific DB and export core tables only:
wp_commentmeta
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_users
B. No need to discuss more
C. Same above
D. Now most troubles and headache occur, for examples:
D.1. The DB downloaded from the live website might be too big (usually more than 8MB). There are several solutions to this problems by Googling. I found a good one, which is to edit the config.inc.php file inside the phpMyAdmin directory of the XAMPP directory (xampp in C: drive) by adding the following code:
$cfg['UploadDir'] = xxx; before the last closing php (?>), where xxx is a new directory you create inside the phpMyAdmin directory.
- You are free to name xxx. Move or copy the DB .sql file from the step 1 into xxx.
- You are now able to import the large DB file by using XAMPP phpMyAdmin, by selecting the DB file in the xxx directory from the dropdown list. At this time, half of the work is done.
D.2. The last half, yet critical, is to modify 2 values in the wp_options table of the DB.
Looking for the values (siteurl and home) and make changes: from http://yourwebsite.com to http://localhost/abc, where abc is the directory of the WP, might be ‘wordpress’ if you installed the default way.
D.3. Now you are good to go.