plugins_api
Filter HookDescription
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', an array should be passed.Hook Information
File Location |
wp-admin/includes/plugin-install.php
View on GitHub
|
Hook Type | Filter |
Line Number | 145 |
Hook Parameters
Type | Name | Description |
---|---|---|
false|object|array
|
$result
|
The result object or array. Default false. |
string
|
$action
|
The type of information being requested from the Plugin Installation API. |
object
|
$args
|
Plugin API arguments. |
Usage Examples
Basic Usage
<?php
// Hook into plugins_api
add_filter('plugins_api', 'my_custom_filter', 10, 3);
function my_custom_filter($result, $action, $args) {
// Your custom filtering logic here
return $result;
}
Source Code Context
wp-admin/includes/plugin-install.php:145
- How this hook is used in WordPress core
<?php
140 *
141 * @param false|object|array $result The result object or array. Default false.
142 * @param string $action The type of information being requested from the Plugin Installation API.
143 * @param object $args Plugin API arguments.
144 */
145 $res = apply_filters( 'plugins_api', false, $action, $args );
146
147 if ( false === $res ) {
148
149 $url = 'http://api.wordpress.org/plugins/info/1.2/';
150 $url = add_query_arg(
PHP Documentation
<?php
/**
* 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', an array should be passed.
*
* @since 2.7.0
*
* @param false|object|array $result The result object or array. Default false.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param object $args Plugin API arguments.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-admin/includes/plugin-install.php
Related Hooks
Related hooks will be displayed here in future updates.