themes_api

Filters whether to override the WordPress.org Themes API.

Description

apply_filters( 'themes_api', (bool) $false, (string) $action, (object) $args ); 

Passing 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.

Parameters (3)

0. $false (bool) => false
Whether to override the WordPress.org Themes API. Default false.
1. $action (string)
Requested action. Likely values are theme_information,, feature_list., or query_themes.
2. $args (object)
Arguments used to query for installer pages from the Themes API.

Usage

To run the hook, copy the example below.
  1. $false = apply_filters( 'themes_api', $false, $action, $args ); 
  2.  
  3. if ( !empty( $false ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the themes_api callback 
  2. function filter_themes_api( $false, $action, $args ) { 
  3. // make filter magic happen here... 
  4. return $false
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'themes_api', 'filter_themes_api', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'themes_api', 'filter_themes_api', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/includes/theme.php  
  1. $res = apply_filters( 'themes_api', false, $action, $args );