current_theme_supports-<feature>

Filters whether the current theme supports a specific feature.

Description

apply_filters( 'current_theme_supports-<feature>', (bool) $true, (array) $args, (string) $wp_theme_features_feature ); 

The dynamic portion(s) of the hook name refer to the specific theme feature. Possible values include post-formats,, post-thumbnails., custom-background, 'custom-header', menus, automatic-feed-links, html5, and customize-selective-refresh-widgets.

Parameters (3)

0. $true (bool) => true
True Whether the current theme supports the given feature. Default true.
1. $args (array)
Array of arguments for the feature.
2. $wp_theme_features_feature (string)
The wp theme features feature.

Usage

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

Defined (1)

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

/wp-includes/theme.php  
  1. return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature] );