Filter hook 'themes_api'

in WP Core File wp-admin/includes/theme.php at line 542

View Source

themes_api

Filter Hook
Description
Filters whether to override the WordPress.org Themes API. Returning a non-false value will effectively short-circuit the WordPress.org API request. If `$action` is 'query_themes', 'theme_information', or 'feature_list', an object MUST be passed. If `$action` is 'hot_tags', an array should be passed.

Hook Information

File Location wp-admin/includes/theme.php View on GitHub
Hook Type Filter
Line Number 542

Hook Parameters

Type Name Description
false|object|array $override Whether to override the WordPress.org Themes API. Default false.
string $action Requested action. Likely values are 'theme_information', 'feature_list', or 'query_themes'.
object $args Arguments used to query for installer pages from the Themes API.

Usage Examples

Basic Usage
<?php
// Hook into themes_api
add_filter('themes_api', 'my_custom_filter', 10, 3);

function my_custom_filter($override, $action, $args) {
    // Your custom filtering logic here
    return $override;
}

Source Code Context

wp-admin/includes/theme.php:542 - How this hook is used in WordPress core
<?php
 537  	 * @param false|object|array $override Whether to override the WordPress.org Themes API. Default false.
 538  	 * @param string             $action   Requested action. Likely values are 'theme_information',
 539  	 *                                    'feature_list', or 'query_themes'.
 540  	 * @param object             $args     Arguments used to query for installer pages from the Themes API.
 541  	 */
 542  	$res = apply_filters( 'themes_api', false, $action, $args );
 543  
 544  	if ( ! $res ) {
 545  		$url = 'http://api.wordpress.org/themes/info/1.2/';
 546  		$url = add_query_arg(
 547  			array(

PHP Documentation

<?php
/**
	 * Filters whether to override the WordPress.org Themes API.
	 *
	 * Returning a non-false value will effectively short-circuit the WordPress.org API request.
	 *
	 * If `$action` is 'query_themes', 'theme_information', or 'feature_list', an object MUST
	 * be passed. If `$action` is 'hot_tags', an array should be passed.
	 *
	 * @since 2.8.0
	 *
	 * @param false|object|array $override Whether to override the WordPress.org Themes API. Default false.
	 * @param string             $action   Requested action. Likely values are 'theme_information',
	 *                                    'feature_list', or 'query_themes'.
	 * @param object             $args     Arguments used to query for installer pages from the Themes API.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/theme.php
Related Hooks

Related hooks will be displayed here in future updates.