YahnisElsts/wp-update-server

Plugin slug %s is already in use by %s . Slugs must be unique.

Closed this issue · 1 comments

For some reason, when I save in functions.php the basic
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
function

It says that error:
Plugin slug %s is already in use by %s . Slugs must be unique.

Obviously, the plugin slug is already in use... becuase that it the plugin i want to update

The format is:

$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://my.server.com/?action=get_metadata&slug=my-awesome-plugin',
	get_home_path().'/wp-content/plugins/my-awesome-plugin/my-awesome-plugin.php',  
	'my-awesome-plugin'
);

So I can't understand why there is an error when technically this is what the docs suggest

This error message means that the slug was already in use before the code was executed. Usually that means that another plugin is using the same slug, but in this case it could also mean that your code was executed multiple times in one request. Make sure that you're only creating one instance of the update checker for each plugin or theme.

By the way, why is this plugin-related code in functions.php? Could it be that there are multiple copies of the same code - one in the plugin and another in the theme? That could also cause an error like the one you saw.