One of the mostest ubercoolest feature in WordPress is its ability to warn you about an outdated plugin you might be running on your blog, so you can upgrade in a snap and as soon as a new version gets off the press (assuming this plugin is hosted on wp.org/plugins)
The thing is: it's cool… when it works. After updating my own plugins recently to make them WordPress 2.5 friendly, I noticed that my "Manage Plugins" page was not warning me about new versions. Me. Their very genitor. What a shame. After a bit of testing and abusing the API server from wordpress.org, I realized that there are a few innocent things you can do, both as a plugin coder and a user, that will prevent the update system from working as intended.
I found four checkpoints to make sure everything will work as expected:
Consistency is the word
OK, "Consistency is the last refuge of the unimaginative" (Oscar Wilde) but we're talking about making things work here. So, let's try to be unimaginative :) The key is to ensure consistency between the following 4 properties:
- the plugin's name in its readme.txt
- the plugin's name in the PHP plugin header
- the plugin's directory name in the repository
- the plugin's directory name on your own server, within wp-content/plugins/
Let's say for example you have been approved for a plugin named "Joe's Super Stuff" which will be located at http://wordpress.org/extend/plugins/joe-super-stuff/. From what my tests have taught me, the plugin updater will fail upon one (or more) of the following:
- Plugin name in readme.txt is not "Joe Super Stuff"
- Plugin name in PHP file is not "Joe Super Stuff"
- User does not install plugin in wp-content/plugins/joe-super-stuff/
For instance, if plugin name is set to "Joe's Super Stuff" (extra 's) or located in directory "super-stuff", the plugin update system won't relate the installed plugin with the one on the central repository.
Troubleshooting your own installation
I've your suspicious about a plugin that does not mention the existence of an update when you think there should be one, I've set up a quick "validator" tool: the WordPress Plugin Update Check.
Enter in the form the plugin name as it appears in both the readme.txt and the PHP file. If everything goes yay, the script fetches the latest info about this plugin, which are its version number of course but also its "slug", ie the directory it lives in. If something goes moo, that means at least one of the 4 checkpoints about consistency as I describe above has not been passed: directory installation (user's fault), or name in readme and/or PHP file (coder's fault).
Got a plugin that never tells you about an update ? Happy hunting! :)
Want to share or tweet this post? Please use this short URL: http://ozh.in/hl