WordPress 3.0 and flush_rewrite_rules

I thought I would document this experience I had when upgrading some sites to WordPress 3.0.

After WordPress 3.0 came out I took some time to upgrade blogs I manage and was impressed how well the upgrades fared. No issues, fair warnings and ultimately upgraded sites. However, on one of my development sites, after the upgrade, I noted an error about “error re-declaring the function flush_rewrite_rules()”. I knew, for this site in particular, that I had written some custom code to rewrite the urls and in this case I had innocently included a function called “flush_rewrite_rules()”. Coincidentally, in WordPress 3.0 a new core function has been created called “flush_rewrite_rules()” and because that now exists my function is interfering with this and required fixing. The fix, in this case was to rename my custom function and test and I thought nothing more of it. (I know – I should have participated in the beta test).

I didn’t think anything of it after that until I was asked to assist with another clients site. This time the client had innocently upgraded their site to WordPress 3.0 and encountered a white screen with the long PHP error referencing “error re-declaring the function  flush_rewrite_rules()”. The difference this time was that it was in a plugin causing the issue and as such the site was rendered inaccessible.

For this client I connected via FTP and downloaded the plugin code, searched for the function named  “flush_rewrite_rules()” (along with any references to it) and renamed it through the code. After uploading the change the site was restored back to normal.

A simple fix for this site but also a simple lesson in heeding the warnings / suggestions given by the WordPress upgrade tool when upgrading to WordPress 3.0

Leave a Reply

Your email address will not be published. Required fields are marked *