WordPress Upgrades

Wordpress IconWhen dealing with website upgrades, one of the main concerns is trying to make the upgrades go as smooth as possible, but the other concern is that upgrades need to be executed as fast as possible to minimize down time. When it comes to the web, it is a 24 hour cycle, and even 15 minutes of down time can cost web site owners money. Given this, I have come up with the following upgrade process for minor WordPress upgrades, that minimizes down time for web site users, and makes the process a little easier on me.

Verify Backup

Never perform any kind of upgrade without a backup! In the case of WordPress, make sure you have a current database backup and a backup of your wp-config.php file. Now on with the upgrade process…

Prepare Your WordPress Upgrade Files

1. The first thing I do is delete any unnecessary files from the new WordPress release. I do not use the classic theme at all, so I usually delete that theme.

  • wp-config-sample.php
  • license.txt
  • readme.html
  • wp-admin\install.php
  • wp-content\themes\classic
  • wp-content\plugins\hello.php

2. Rename the following folders:

  • wp-admin to wp-admin-new
  • wp-include to wp-include-new

Uploading Files

3. Upload the two folders that you renamed to your WordPress root directory. Note that this will not overwrite the current folders, since they are named differently. This results in not interrupting the up-time of your site until the next step.

4. Upload all the root files to your site, overwriting the current files already there. Sometimes, it is best to delete the root files first instead of overwriting them, so choose whatever method you prefer. Note that you should keep the wp-config.php file; do not delete this file ever or it will cause problems.

5. Upload the contents of the wp-content folder, meaning you now have to upload the contents of the wp-content/themes and wp-content/plug-ins directories.

Finish Upgrade

6. Most WordPress upgrades want you to confirm the upgrade.php file. This usually runs database changes and such, but for minor builds, it is a good way of confirming the upgrade process worked.

  • Run domain_name/wp-admin/upgrade.php

7. Lastly if all went well, you just need to delete upgrade.php and you are done!

Some Notes

Make sure you are familiar with the upgrade process for WordPress and note that some major upgrades may require changes to theme files and such. You may need to modify this upgrade process for a particular WordPress release.

Div Tags Formatting

I had a slight problem with the WordPress 2.1 upgrade, that I traced to defect #3669. However even after I applied the patch code from the defect, I still had problems. I ended up having to live with P tags inside my DIV tags. The problem was that depending on how I inputted a DIV tag in my posting, WordPress would automatically add a P tag inside the DIV, but would not close it properly. I noticed it only because it messed up the look of some of my advertisement blocks. The patch fixed the problem with the paragraph tag closing, but to fix my rendering, I had to actually add to my CSS stylesheet code.

Other than this slight issue, the 2.1 upgrade went well. It is even slightly faster than 2.0.6.

WordPress Internal Errors

Recently I had some problems with another site that I maintain and I had to move the entire domain to a different physical server, and of course the WordPress installation decided to break along the way. There were various problems, but I would have to sum it up as not being able to access anything in the wp-admin folder. Every time I tried to access the admin side of WordPress, I would receive an internal error 500, along with 403’s. After researching this issue for a while, it turns out my original .htaccess file was not restored. More importantly, the workaround for mod_security was not in my .htaccess file. Adding this to the root .htaccess file fixed the problem with not being able to access the admin interface:

<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

I also use the plugin WP-Cache, which can cause problems if you move your WordPress installation; this usually comes up as a php include error: wp-settings.php on line 69. The fix is to remove define(“WP_CACHE”, true); from the wp-config.php file. If that still does not fix the problem, then you might have to remove all of the files created by WP-Cache:

wp-content/advanced-cache.php
wp-content/cache/*
wp-content/plugins/wp-cache/*

If you recently moved your files to another server or renamed your home directory, then the problem is the symbolic link advanced-cache that is under wp-content. Most FTP programs will not show the link, so you must either delete it from within cPanel’s FileManager or shell into your account and do it that way. You can then usually just deactivate and re-activate the plugin, and when you enable caching, it should recreate the link.

And then there is this problem with WordPress 2.0.5.

WordPress Titles

Since I started using Mint, every time I looked on the Pages section, it would show abbreviated titles for the pages that were accessed. I soon realized that the problem was not so much Mint, but that my actual Title tags from WordPress all started with my website’s name and then the actual blog entry title. A more readable title would be one that started with the actual title of the blog entry instead of “WebKeyDesign >> My Post Title”. In order to change this you have to edit the Title tag code in your WordPress theme. You can find a good tutorial on modifying the WordPress Title tag on Ardamis.com.

Here is what I changed the Title tag to:

<title><?php wp_title(' '); ?><?php if(wp_title(' ', false)) { echo ' | '; } ?><?php bloginfo('name'); ?></title>

There is one slight problem though which Ardamis mentions, namely there are some spaces that get inputted into the Title tag. Ardamis does offer a workaround for this, but search engines will not care about the extra spaces, so you can do without the workaround if you like.

Worst Spammers

The best feature of WordPress 2.0 is definitely the addition of Akismet. This comment spam blocking plugin has single-handedly made blogging fun again. Not having to deal with hundreds or thousands of junk spam comments gives you more time to write and post worthwhile content. If you are upgrading, Akismet comes with WordPress 2.0, but you can also check out Worst Offenders, which makes it easier to identify your worse spammers, by giving you a list of the top offenders and their IP addresses.

WP-Shortstat Broken With WordPress 2.0.1

My new website MovieComment.com was setup with WordPress 2.0, and so when the 2.0.1 release showed up, I went ahead and upgraded it. Thinking everything went okay, I forgot to check all the plugins, and it appears that WP-Shortstat 1.3 and WordPress 2, no longer work after installing the 2.0.1 update. No new hits are tracked anymore, but you can still view whatever stats you had prior to the upgrade.

The reason is that there is a conflict with the Google Sitemap plugin. HappyArts Blog though has modified WP-Shortstat to work around the problem, and it appears to be working for me now.

HappyArts Blog is a German blog, so you might want to have Google translate HappyArts Blog for you.

Update: HappyArts Blog has incorporated my CSS changes into his version of WP-Shortat. There is also a download page in English.