Opened 3 years ago
Closed 3 years ago
#6032 closed defect (bug) (fixed)
plugins_api() 'downloadlink', 'reviews', and 'versions' query args do nothing.
Reported by: | jsmoriss | Owned by: | dd32 |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | API | Keywords: | |
Cc: |
Description
The following query should return the plugin reviews, and not a download link or the versions array, but these three query arguments do not work.
Example test script:
#!/usr/bin/php <?php define( 'BASE_PATH', '/.../wordpress/' ); require( BASE_PATH . 'wp-load.php' ); require( BASE_PATH . 'wp-admin/includes/plugin-install.php' ); $plugin_api_data = plugins_api( 'plugin_information', array( 'slug' => 'wordpress-seo', 'fields' => array( 'active_installs' => false, 'added' => false, 'banners' => false, 'compatibility' => false, 'description' => false, 'donate_link' => false, 'downloaded' => false, 'downloadlink' => false, // Does not work. 'contributors' => false, 'group' => false, 'homepage' => false, 'icons' => false, 'last_updated' => false, 'rating' => true, 'ratings' => true, 'reviews' => true, // Does not work. 'requires' => false, 'requires_php' => false, 'sections' => false, 'short_description' => false, 'tags' => false, 'tested' => false, 'versions' => false, // Does not work. ), ) ); print_r( $plugin_api_data );
Outputs (I've trimmed the screenshots and versions arrays for brevity):
stdClass Object ( [name] => Yoast SEO [slug] => wordpress-seo [version] => 17.9 [author] => <a href="https://yoa.st/1uk">Team Yoast</a> [author_profile] => https://profiles.wordpress.org/joostdevalk/ [rating] => 96 [ratings] => Array ( [5] => 25772 [4] => 619 [3] => 178 [2] => 125 [1] => 731 ) [num_ratings] => 27425 [support_threads] => 460 [support_threads_resolved] => 372 [download_link] => https://downloads.wordpress.org/plugin/wordpress-seo.17.9.zip [screenshots] => Array ( [1] => Array ( [src] => https://ps.w.org/wordpress-seo/assets/screenshot-1.png?rev=2643727 [caption] => The Yoast SEO plugin general meta box. You'll see this on edit post pages, for posts, pages and custom post types. ) ) [versions] => Array ( [17.9] => https://downloads.wordpress.org/plugin/wordpress-seo.17.9.zip [trunk] => https://downloads.wordpress.org/plugin/wordpress-seo.zip ) )
Change History (8)
#1
@
3 years ago
- Owner set to dd32
- Status changed from new to accepted
This ticket was mentioned in Slack in #meta by dd32. View the logs.
3 years ago
#5
in reply to:
↑ 3
@
3 years ago
Replying to dd32:
- Requesting
reviews
withoutsections
will now result insections.reviews
being returned still
Hmm.. That might be a mistake. Now explicitly disabling sections (but not touching 'reviews' which defaults to on) returns sections.reviews anyway: https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=hello-dolly&request[fields][sections]=0
I might revert that, or disable reviews if sections is disabled without an explicit request for reviews.. later today..
I'll take a closer look this week, but note that for reviews they should be present in the response as
sections.reviews
not justreviews
:They should be included by default as of the 1.2 API, but they're not so I'm guessing I've got an
array_merge()
in the wrong order.