I am currently writing a simple-ish plugin with custom posts and a couple functions, using post metadata and adding a couple of variables to the “options” table in the database. During my research, I saw some references in the WP Codex about making the plugin backwards compatible with versions before WP 3.x and I was just wondering how important it is now to incorporate that compatibility.
For instance, the oldest version of WP I ever saw installed (by a client) was 3.2, or somewhere around there. I cannot imagine many people having anything older than 3.x but I could be wrong. I know in theory you should always try to make it perfectly compatible but, realistically, does anyone know how important it is to include that capability?
Thanks
Always write plugins for the current version and keep the nightly builds from the upcoming versions in mind. Anything else doesn’t matter.
Edit As @toscho pointed out in a comment:
There might be some explanation needed to why it is that way.
Now go ask yourself:
Remember the release of WordPress 3.0 required PHP5. At the time, many hosting companies were not yet running PHP5 on their servers. So there was a period of time when some WordPress sites COULDN’T update to WordPress 3.0 because their hosting companies were not keeping their servers up to date.
Many years have now passed (3+) since the release of WordPress 3.0, so being backwards compatible with WordPress < 3.x is not very common plugins.
Most WordPress installations are outdated. Currently, only 5.2% of all installations are running on the latest release 3.6.
27.3% are still on version 3.0.
You might think you have to support these old versions with compatible code. But think about the implications:
And the users of these will probably not even install your plugin because they know already new plugins break their site. In terms of market reach you might win a little bit with backwards compatible code. In terms of efficiency you lose.
My rule of thumb for plugins I write is support for the current version minus 1, so all plugins I’d write would be compatible with 3.6.x and 3.5.x. While a particular plugin may work on earlier versions, I don’t guarantee it nor support it if you run into problems.
Four months ago, I took over the maintenance of a popular plugin. Before I started working on it, the plugin hadn’t had an update in 2 years. I made a bunch of bug fixes, released the new version, and 2 days later heard from a guy who said the new version caused the white-screen-of-death on his site. After I looked into it, he was still running WordPress 2.9.2, and my update used the home_url function, introduced in 3.0. I have no idea why the guy decided to update this plugin immediately, even though he hadn’t updated his WordPress installation in 3 years. When I made the new version, I never thought to test WordPress 2.9.2.
Here is the moral to the story: In your plugin’s readme.txt file, there is a “Requires at least” version number in the header. Use it. As you make updates, if you don’t feel like testing old versions, increment it. That will discourage users refusing to update their WordPress installations from updating your plugin.
I’m currently writing a new, related plugin, and I’m planning on making it WordPress 3.6 only, because I want to use the getid3 library included in the core. I have no desire to release a new plugin for an old core version.