Open lajennylove opened 1 year ago
Hi, @lajennylove. I struggled with this as well. I combined Misha's tutorial with this thread on StackExchange, which explicitly says that information for multiple plugins can be added to the JSON output. The way Misha's code (and the code on StackExchange) is written, it's only expecting a single JSON object with a key of your_plugin_folder/your_plugin_filename.php
. If, say, you added multiple items to an array in PHP and json_encode()
it, a JSON array of objects would be produced. In other words, with one item your JSON looks like this...
{ "plugin_folder/plugin_filename.php" : ... }
...but with multiple items, your JSON looks like this...
[ { "plugin_folder/plugin_filename1.php" : ... },
{ "plugin_folder/plugin_filename2.php" : ... },
{ "plugin_folder/plugin_filename3.php" : ... } ]
It's an array of objects, not an object. So what can you do? Well, there are a few options:
On another note, it's no longer necessary to use the transients API. Two new filters handle that component natively and they support plugins and themes, respectively: update_plugins_{$hostname}
(since 5.8) and update_themes_{$hostname}
(since 6.1).
I hope this helps!
Hello there!
First, I want to tank you because this plugin works amazingly good that I create a custom post type with custom fields to have an endpoint to use it as a plugin's repository. Everything worked well until I try to see the details of my second plugin.
When I click on "View version x.x details" this is what I get.
The first plugin that I create works just fine.
All the validations to show the updates works just fine.
Do you have any ideas of how could I fix this?