plugins_api


plugins_api ( $action, $args = array() )

Parameters:
  • (string) $action API action to perform: 'query_plugins', 'plugin_information', 'hot_tags' or 'hot_categories'.
  • (array|object) $args { Optional. Array or object of arguments to serialize for the Plugin Info API.
Returns:
  • (object|array|WP_Error) Response object or array on success, WP_Error on failure. See the {@link https://developer.wordpress.org/reference/functions/plugins_api/ function reference article} for more information on the make-up of possible return values depending on the value of `$action`.
Defined at:

Description

Retrieves plugin installer pages from the WordPress.org Plugins API.

It is possible for a plugin to override the Plugin API result with three filters. Assume this is for plugins, which can extend on the Plugin Info to offer more choices. This is very powerful and must be used with care when overriding the filters.

The first filter, {@see 'plugins_api_args'}, is for the args and gives the action as the second parameter. The hook for {@see 'plugins_api_args'} must ensure that an object is returned.

The second filter, {@see 'plugins_api'}, allows a plugin to override the WordPress.org Plugin Installation API entirely. If $action is 'query_plugins' or 'plugin_information', an object MUST be passed. If $action is 'hot_tags' or 'hot_categories', an array MUST be passed.

Finally, the third filter, {@see 'plugins_api_result'}, makes it possible to filter the response object or array, depending on the $action type.

Supported arguments per action:

Argument Name query_plugins plugin_information hot_tags hot_categories
$slug No Yes No No
$per_page Yes No No No
$page Yes No No No
$number No No Yes Yes
$search Yes No No No
$tag Yes No No No
$author Yes No No No
$user Yes No No No
$browse Yes No No No
$locale Yes Yes No No
$installed_plugins Yes No No No
$is_ssl Yes Yes No No
$fields Yes Yes No No

Related Functions

plugins_url, is_plugin_active, add_plugins_page, plugin_dir_url, is_plugin_page

Top Google Results

User discussions

wpseek mobile