current_theme_supports()
Checks a theme's support for a given feature
Example usage:
current_theme_supports( 'custom-logo' ); current_theme_supports( 'html5', 'comment-form' );
1 time — 0.000013 sec (very fast) | 50000 times — 0.01 sec (speed of light) | PHP 7.0.8, WP 4.6.1
Hooks from the function
Return
true|false
. True if the active theme supports the feature, false otherwise.
Usage
current_theme_supports( $feature, ...$args );
- $feature(string) (required)
- The feature being checked. See add_theme_support() for the list of possible values.
- ...$args(mixed) (required)
- Optional extra arguments to be checked against certain features.
Examples
#1 Check if theme feature is supported
if( current_theme_supports( 'custom-header' ) ){ // do something - the custom-header feature is enabled. }
Notes
- Global. Array. $_wp_theme_features
Changelog
Since 2.9.0 | Introduced. |
Since 5.3.0 | Formalized the existing and already documented ...$args parameter by adding it to the function signature. |