Will current_theme_supports() return TRUE with a nonstandard add_theme_support() string?

If I do this in my theme:

add_theme_support( 'my_funky_new_thing' );

Can someone else writing a plugin do this?

if( current_theme_supports( 'my_funky_new_thing' ) ){
    // ...

Yes. You can take advantage of this to enable or disable features in your plugin if a theme does or does not declare support for a feature. WooCommmerce is an example of a plugin that does this.


As a side note for those interested, you can also pass parameters with your custom theme support.

// theme functions.php
add_theme_support( 'some_feature', array(
) );

// plugin.php
$feature_args = get_theme_support( 'some_feature' );
var_dump( $feature_args );
// array(
//   array(
//     'arg_foo',
//     'arg_bar'
//   )
// );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.