Making WordPress.org

Opened 6 weeks ago

Last modified 6 weeks ago

#4253 new defect

Plugins API `query_plugins` produces wrong number of results

Reported by: schlessera Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords:


The per_page argument for the Plugins API query_plugins action seems to return the wrong number of results in some cases.

So, if you limit the per_page to 20, you only get 19 items back event though that there are more than 20 results available.

We are hitting this issue with the WP-CLI plugin search command, which shows the exact count of elements returned. See https://github.com/wp-cli/extension-command/issues/156 for the related issue.

Change History (3)

#1 @Otto42
6 weeks ago

This appears to be because one of the results in that particular search query is a closed plugin. It shouldn't be appearing at all in the results, one would think.

The API filters it out thus creating the wrong count. Not sure why it comes back in the search results in the first place though.

#2 @dd32
6 weeks ago

I think I'm okay with the API returning less than the paged amount of results as a whole, but reducing those cases is certainly worthwhile.

Currently none of the post statuses are marked as excluded from search, so doing that might help (patch not needed)

Looking at the ElasticSearch search & result though, it doesn't reference the post_status field anywhere, but upon looking into it, the disabled plugin is showing as "post_status": "publish", within Elastic Search, so it could just be an ingestion bug.

#3 @dd32
6 weeks ago

  • Component changed from API to Plugin Directory
Note: See TracTickets for help on using tickets.