plugins_api
Filters the response for the current WordPress.org Plugin Installation API request.
Returning a non-false value will effectively short-circuit the WordPress.org API request.
If $action is 'query_plugins' or 'plugin_information', an object MUST be passed. If $action is 'hot_tags' or 'hot_categories', an array should be passed.
Usage
add_filter( 'plugins_api', 'wp_kama_plugins_api_filter', 10, 3 ); /** * Function for `plugins_api` filter-hook. * * @param false|object|array $result The result object or array. * @param string $action The type of information being requested from the Plugin Installation API. * @param object $args Plugin API arguments. * * @return false|object|array */ function wp_kama_plugins_api_filter( $result, $action, $args ){ // filter... return $result; }
- $result(false|object|array)
- The result object or array.
Default: false - $action(string)
- The type of information being requested from the Plugin Installation API.
- $args(object)
- Plugin API arguments.
Changelog
Since 2.7.0 | Introduced. |
Where the hook is called
wp-admin/includes/plugin-install.php 150
$res = apply_filters( 'plugins_api', false, $action, $args );