Using WordPress ‘install_plugins_table_api_args_{$tab}’ PHP filter

The install_plugins_table_api_args_{$tab} WordPress PHP filter allows you to modify API request arguments for each Add Plugins screen tab.

Usage

add_filter('install_plugins_table_api_args_favorites', 'modify_favorites_api_args', 10, 1);

function modify_favorites_api_args($args) {
    // Your custom code here
    return $args;
}

Parameters

  • $args (array|false): Plugin install API arguments.

More information

See WordPress Developer Resources: install_plugins_table_api_args_{$tab}

Examples

Modifying Favorites Tab API Arguments

To modify the API request arguments for the Favorites tab, use the install_plugins_table_api_args_favorites filter.

add_filter('install_plugins_table_api_args_favorites', 'modify_favorites_api_args', 10, 1);

function modify_favorites_api_args($args) {
    $args['user'] = 'custom_user';
    return $args;
}

To modify the API request arguments for the Featured tab, use the install_plugins_table_api_args_featured filter.

add_filter('install_plugins_table_api_args_featured', 'modify_featured_api_args', 10, 1);

function modify_featured_api_args($args) {
    $args['locale'] = 'en_US';
    return $args;
}

To modify the API request arguments for the Popular tab, use the install_plugins_table_api_args_popular filter.

add_filter('install_plugins_table_api_args_popular', 'modify_popular_api_args', 10, 1);

function modify_popular_api_args($args) {
    $args['per_page'] = 50;
    return $args;
}

To modify the API request arguments for the Recommended tab, use the install_plugins_table_api_args_recommended filter.

add_filter('install_plugins_table_api_args_recommended', 'modify_recommended_api_args', 10, 1);

function modify_recommended_api_args($args) {
    $args['paged'] = 2;
    return $args;
}

Modifying Search Tab API Arguments

To modify the API request arguments for the Search tab, use the install_plugins_table_api_args_search filter.

add_filter('install_plugins_table_api_args_search', 'modify_search_api_args', 10, 1);

function modify_search_api_args($args) {
    $args['search'] = 'custom_search';
    return $args;
}