[wp-hackers] Best practice for replacing a plugin in the repo with a new one
otto at ottodestruct.com
Wed Aug 10 15:18:10 UTC 2011
Changing the plugin slug is not possible. Nor should you be trying to
do so, the slug is outside the scope of the plugin user's view. If you
want to give the plugin a different name, then just change the name in
the PHP file.
If you are deprecating an old plugin and want to switch users to
another one, then there is a way, but it's a bit complex and not
guaranteed. It works because the plugin URL has a slightly higher
priority than the plugin slug in the matching algorithm.
In the plugin's PHP file, there's a place in the header to put the
Plugin URI:. WordPress.org treats this as a unique identifier for the
plugin. The URI value you put here should be something unique to the
plugin and within your control (so, something on your own site and not
a wordpress.org URL).
When a plugin update request is made by a site, that URI field is sent
along and used to match against plugins in the repository. Again,
wordpress.org URIs are ignored here.
If the URIs match, then that value has a slightly higher weight than
the directory-name to slug match does.
Now, obviously, if both the URI and the slug matched, then this
wouldn't matter. However, if you shift the Plugin URI value on an old
plugin to match that of a new plugin, then wait for your users to all
update, and then remove the URI value on the old plugin, now the only
match that plugin has is the slug match, and the plugin URI will match
the new plugin, and outweigh it. Thus causing those users to see an
update to your new, different, plugin.
You could go further with this and just update ALL of the old plugin
to the new plugin code, Plugin URI included, then leave it a while,
and eventually just remove the plugin files from the old plugin's
repository. Without anything to match against, the old plugin will
match the new plugin in the update check, and will get its updates.
This is a simpler and more direct approach, and probably more likely
to succeed. Plus your users instantly get all the benefits of your new
I have not actually done this, nor have I heard of anybody doing it.
But from my reading of the code, it should work.
On Wed, Aug 10, 2011 at 10:04 AM, Alex Hempton-Smith
<hempsworth at gmail.com> wrote:
> So I guess I'd like to know if you can rename a plugin in the repo - and if
> you can't, how would I do something similar?
> - - - -
> Kind regards,
> Alex Hempton-Smith
> On Wed, Aug 10, 2011 at 12:46 PM, Alex Hempton-Smith
> <hempsworth at gmail.com>wrote:
>> I have a plugin in the WP repository (BuddyPress Like) which I haven't
>> updated in quite some time. I'm working on a new plugin that will replicate
>> all of the functionality of BP Like, but will not be BuddyPress specific.
>> There will be an importer so all BP Like data will move into the new plugin
>> What is the best practice for effectively depreciating an old plugin and
>> direct users to a new one?
>> Ideally I could rename BP Like in the repository, and just have the new
>> version replace the old one... but renaming isn't possible?
>> - - - -
>> Kind regards,
>> Alex Hempton-Smith
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers