I was digging into the plugin code and I see that you’re currently just scraping content from the HTML side for each plugin. Though this works, WP actually provides an API for retrieving info about plugins.
Though the method you’re using currently works, it’s a little less efficient and prone to breaking if WP ever changes their design. The API is documented and will always return what you expect.
Sorry, one other thing. Looks like the formula for calculating overall ratings for all plugins is incorrect. Currently it takes a straight average of the star rating for each, but this assumes the same number of ratings have been given for each plugin, which would almost never be the case.
The following pseudocode would return a true average of all plugin ratings:
This is especially an issue if you have a plugin with no ratings yet. That currently averages in as a zero, which wouldn’t make sense since a non-rated plugin is not the same as a plugin that has been rated a zero.
All the best!
Viewing 1 replies (of 1 total)
The topic ‘WordPress Plugin Info API’ is closed to new replies.