Using WordPress ‘get_theme_support()’ PHP function

The get_theme_support() WordPress PHP function retrieves the theme support arguments passed when registering that support.

Usage

get_theme_support('custom-logo');
get_theme_support('custom-header', 'width');

Parameters

  • $feature (string) – Required. The feature to check. See add_theme_support() for the list of possible values.
  • $args (mixed) – Optional. Extra arguments to be checked against certain features.

More information

See WordPress Developer Resources: get_theme_support()

Examples

Get custom logo support arguments

// Get the custom logo theme support arguments
$custom_logo_support = get_theme_support('custom-logo');

// Output the custom logo support arguments
print_r($custom_logo_support);

Get custom header support arguments

// Get the custom header theme support arguments
$custom_header_support = get_theme_support('custom-header');

// Output the custom header support arguments
print_r($custom_header_support);

Check if a theme supports post thumbnails

// Check if the theme supports post-thumbnails
if (current_theme_supports('post-thumbnails')) {
    echo "This theme supports post thumbnails.";
} else {
    echo "This theme does not support post thumbnails.";
}

Get HTML5 support arguments

// Get the HTML5 theme support arguments
$html5_support = get_theme_support('html5');

// Output the HTML5 support arguments
print_r($html5_support);

Check if a theme supports responsive embeds

// Check if the theme supports responsive-embeds
if (current_theme_supports('responsive-embeds')) {
    echo "This theme supports responsive embeds.";
} else {
    echo "This theme does not support responsive embeds.";
}