I’ve wrapped a quick hack as a plugin to add Google Analytics to my site. Named it “Google Analytics” and, sure enough, WP offered me to upgrade my v0.1 plugin to some random plugin from the plugin repo.
I vaguely recall it getting raised a few times around WP 2.7 to 3.0. Is there a new API available somewhere to disable this, or is the only way to avoid it still is to prefix plugin names (not their file name, but their actual name as shown in the Plugins screen) to make them unique?
In my specific use case, the plugin is in mc-ga/mc-ga.php
and is named “Google Analytics”, along with a few other meta fields at the beginning of the plugin file header. WP yields an update notice based on “Google Analytics” (I couldn’t locate a mc-ga.php
plugin file in the repo).
Does WP allow to add an extra field I’m not aware of, e.g. a repo URL or something truly unique, so as to avoid such conflicts?
You can remove you plugin from the updateble list with:
Adding this filter will eliminate our homonymous plugin altogether from update checks. And it supposes that we are doing the updates manually via simple FPT uploads -or similar. But there are many factors, as discussed in If I rename a plugin (in its main php file) do I still get update notifications?. As per the OP description (same name, different slug), without using a filter, maybe the best is to set the plugin
Version
header to a greater number or using a less conventional number likeyyyy.mm.dd
.If we are setting our own Repo, I believe there won’t be any conflicts.
What I suggest is: before making your plugin, first check whether the name you are going to give already exists in WordPress plugin repository. If not, then you can move forward and develop the plugin.
Case it exists, give a different name to your plugin. Because the upgrade is based on the name, you can’t manage two different plugins with same name. WordPress does this upgrade option automatically from the official repository.
If you have a plugin that’s custom for a site, then give its name the site’s name as a prefix.
We’re certainly not going to allow a plugin named “Example.com – Google Analytics” into the WordPress.org directory.
Additionally, add a “Plugin URI” field to the plugin header. The Plugin URI is used as part of the matching process, and provides something more unique than the name to match against as well.
Adding this one for posterity, in case anyone else needs it: