I've implemented this update class in my plugin, but for some reason the update banner isn't diplayed.
Within the class Wp_License_Manager_Client
I have this code:
add_filter('pre_set_site_transient_update_plugins', array($this, 'check_for_update'));
that fire the function check_for_update
, in particular the following line is called:
$plugin_slug = plugin_basename($this->plugin_file);
$transient->response[$plugin_slug] = (object) array(
'new_version' => $info->version,
'package' => $info->package_url,
'slug' => $plugin_slug,
'url' => $info->package_url
);
This is the var_dump($transient->response[$plugin_slug])
:
object(stdClass)#8891 (4) {
["new_version"]=> string(5) "1.0.1"
["package"]=> string(107) "https://example.com/api/license-manager/v1/get?p=my-plugin&e=foo@mysite.com&l=123456789%24"
["slug"]=> string(47) "my-plugin/public/class-wp-api-client.php"
["url"]=> string(107) "https://example.com/api/license-manager/v1/get?p=my-plugin&e=foo@mysite.com&l=123456789%24"
}
I replaced the values for privacy, but as you can see the object is correctly created.
The situation in the panel is the following:
As you can see from the image Wordpress show me that there is one update, but when I click on "updates", it says that all the plugins are updated. Also, I get the update badge notification only when I clear the cache.
What is going on?
PS: I'm testing this in my localhost with XAMPP and wordpress version is 6.0.1.