Today, blogger ElleDoesIt! gives us a run down of how to prepare your blog before customizing any part of it from your theme, plugins, or content.
Do you like to play under the hood of your WordPress installation? Perhaps by adding plugins or changing the base font of your theme? Do you edit core WordPress files? While WordPress is a powerful platform that works well "out of the box", many users will eventually tweak some files to customize the blogging software to suit their website's needs. Before you make changes to any part of your WordPress installation, keep these tips in mind.
Back it up, back it up, back it up
Have you ever made one simple, seemingly harmless change to a file only to find your entire blog has been damaged? It happens to the best of the best sometimes. Thus, the importance of regular and consistent backups cannot be emphasized enough. So, just what should be backed up?
- WordPress database - If you are comfortable with accessing your MySQL front end (like phpMyAdmin or other), you can manually export your database and save it on your local hard drive. If you want to be a little less hands-on, there are plugins available to assist you in doing regular backups. WP-DBManager and WP-DB-Backup come recommended.
- Site content - From your admin panel, you can do a one-click backup of all your site content. From the export page (Tools / Export), "When you click the button below WordPress will create an XML file for you to save to your computer. This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags."
- Plugins and theme - If something goes awry you could always re-download your currently-used plugins, but life is easier with working backups. Making a backup of your theme directory is also optional, but if you've made any changes to your theme, a backup becomes more important.
- Backups - Make backups of backups (and, perhaps, of backups), some stored locally on your hard drive and others stored on remote machines.
Make copies first
Before editing an individual file for the first time, make a copy of the file with a new name. Take index.php in your theme folder, for example, copy it and rename the copy to something like:
- index.original.php
- index.bu.php (bu for backup)
- index.keep.php
Keep the same file naming convention for all files you'll be making changes to.
Editing core WordPress files
WordPress releases happen regularly. With each upgrade, you may delete core files and folders entirely and replace them with folders from the new release. In doing so, unless you have kept clear records of your edits, you may inadvertently wipe out your core customizations as well. To avoid this altogether, make use of a functions file or plugins to gain the functionality you need.
If you choose to edit core files, make specially-named copies of the original files first as described above. An optional method of renaming the original copy is from index.php, for example, to _index.php. The leading underscore will move the file to the top of the alpha-ordered file list and makes your altered files easier to recognize at a glance. As an added measure, create a new file called _altered.txt. In it, keep a running list of all core files you've edited, the specific changes made (including line numbers), and the reasons you made the changes.
Compare files for changes
Forget to document a change or two? No problem. There are numerous file difference checking programs available that will show you the edits of your ways. If you would like to stay within the WordPress framework, however, there is a plugin called Hash Checker. From the author, "This plugin will help you determine changed file[s] in your WordPress core before you upgrade."
Why is all this necessary?
If you are running a personal blog, are the sole webmaster of your website, and only make a couple of small changes to one file, then perhaps some of these steps and precautions may seem a bit overzealous. Still, making regular backups is advised, as is noting all edits made, if only for the sake of your own sanity down the road.
Running a WordPress-powered website with more than one webmaster or a site that will be passed on to someone else can introduce new challenges. Clearly documented code and available "clean" copies of files will grant multiple and future webmasters the tools they need to continue maintaining the website with relative ease.
And then there is the issue of support. Many WordPress users will visit the support forums, the codex, or a plugin author's website on occasion in search of assistance. Support comes much easier when code changes you've made are clear and concise.
And finally, as mentioned earlier, WordPress releases come at a regular basis. When it comes to upgrading your site, it's better to be well-documented, backed up, and safe than sorry.
What are your methods?
Do you edit non-core files like plugins? How about core files in your WordPress installation? If so, how do you keep up with the changes you make? We'd love to hear your ideas!

Leave a comment