On this page
get_theme_support( string $feature, mixed $args ): mixed
Gets the theme support arguments passed when registering that support.
Description
Example usage:
get_theme_support( 'custom-logo' );
get_theme_support( 'custom-header', 'width' );
Parameters
$featurestring Required-
The feature to check. See add_theme_support() for the list of possible values.
More Arguments from add_theme_support( ... $feature )
The feature being added. Likely core values include:
'admin-bar''align-wide''automatic-feed-links''core-block-patterns''custom-background''custom-header''custom-line-height''custom-logo''customize-selective-refresh-widgets''custom-spacing''custom-units''dark-editor-style''disable-custom-colors''disable-custom-font-sizes''editor-color-palette''editor-gradient-presets''editor-font-sizes''editor-styles''featured-content''html5''menus''post-formats''post-thumbnails''responsive-embeds''starter-content''title-tag''wp-block-styles''widgets''widgets-block-editor'
$argsmixed Optional-
extra arguments to be checked against certain features.
Return
mixed The array of extra arguments or the value for the registered feature.
Source
File: wp-includes/theme.php. View all references
function get_theme_support( $feature, ...$args ) {
global $_wp_theme_features;
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
if ( ! $args ) {
return $_wp_theme_features[ $feature ];
}
switch ( $feature ) {
case 'custom-logo':
case 'custom-header':
case 'custom-background':
if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) {
return $_wp_theme_features[ $feature ][0][ $args[0] ];
}
return false;
default:
return $_wp_theme_features[ $feature ];
}
}
Related
Used By
| Used By | Description |
|---|---|
| _load_remote_featured_patterns() wp-includes/block-patterns.php | Register |
| _load_remote_block_patterns() wp-includes/block-patterns.php | Register Core’s official patterns from wordpress.org/patterns. |
| get_default_block_editor_settings() wp-includes/block-editor.php | Returns the default block editor settings. |
| wp_use_widgets_block_editor() wp-includes/widgets.php | Whether or not to use the block editor to manage widgets. Defaults to true unless a theme has removed support for widgets-block-editor or a plugin has filtered the return value of this function. |
| get_media_states() wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| _register_core_block_patterns_and_categories() wp-includes/block-patterns.php | Registers the core block patterns and categories. |
| WP_REST_Themes_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Prepares a single theme output for response. |
| get_theme_starter_content() wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
| is_header_video_active() wp-includes/theme.php | Checks whether the custom header video is eligible to show on the current page. |
| _custom_logo_header_styles() wp-includes/theme.php | Adds CSS to hide header text for custom logo, based on Customizer setting. |
| get_custom_logo() wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| WP_Customize_Background_Image_Control::enqueue() wp-includes/customize/class-wp-customize-background-image-control.php | Enqueue control related scripts/styles. |
| post_format_meta_box() wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| WP_Posts_List_Table::inline_edit() wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| Custom_Image_Header::get_header_dimensions() wp-admin/includes/class-custom-image-header.php | Calculate width and height based on what the currently selected theme supports. |
| Custom_Image_Header::get_default_header_images() wp-admin/includes/class-custom-image-header.php | Gets the details of default header images if defined. |
| Custom_Image_Header::step_1() wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| Custom_Image_Header::step_2() wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| Custom_Image_Header::reset_header_image() wp-admin/includes/class-custom-image-header.php | Reset a header image to the default image for the theme. |
| Custom_Image_Header::js_1() wp-admin/includes/class-custom-image-header.php | Display JavaScript based on Step 1 and 3. |
| Custom_Image_Header::js_2() wp-admin/includes/class-custom-image-header.php | Display JavaScript based on Step 2. |
| Custom_Background::admin_page() wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| WP_Customize_Manager::register_controls() wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| WP_Customize_Manager::_sanitize_header_textcolor() wp-includes/class-wp-customize-manager.php | Callback for validating the header_textcolor value. |
| get_background_color() wp-includes/theme.php | Retrieves value for custom background color. |
| _custom_background_cb() wp-includes/theme.php | Default custom background callback. |
| add_theme_support() wp-includes/theme.php | Registers theme support for a given feature. |
| _custom_header_background_just_in_time() wp-includes/theme.php | Registers the internal custom header and background routines. |
| _remove_theme_support() wp-includes/theme.php | Do not use. Removes theme support internally without knowledge of those not used by themes directly. |
| get_header_textcolor() wp-includes/theme.php | Retrieves the custom header text color in 3- or 6-digit hexadecimal form. |
| display_header_text() wp-includes/theme.php | Whether to display the header text. |
| get_header_image() wp-includes/theme.php | Retrieves header image for custom header. |
| is_random_header_image() wp-includes/theme.php | Checks if random header image is in use. |
| get_custom_header() wp-includes/theme.php | Gets the header image data. |
| get_background_image() wp-includes/theme.php | Retrieves background image for custom background. |
| WP_Admin_Bar::initialize() wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| WP_Customize_Header_Image_Setting::update() wp-includes/customize/class-wp-customize-header-image-setting.php | |
| get_body_class() wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| wp_xmlrpc_server::wp_getPostFormats() wp-includes/class-wp-xmlrpc-server.php | Retrieves a list of post formats used by the site. |
| WP_Customize_Header_Image_Control::enqueue() wp-includes/customize/class-wp-customize-header-image-control.php | |
| WP_Customize_Header_Image_Control::render_content() wp-includes/customize/class-wp-customize-header-image-control.php |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_theme_support