Must be called in the theme's functions.php file to work.If attached to a hook, it must be 'after_setup_theme'.The 'init' hook may be too late for some features. Example usage: add_theme_support( 'title-tag' );
add_theme_support( 'custom-logo', array(
'height' => 480,
'width' => 720,
) );
wp_setup_widgets_block_editor()Enables the widgets block editor. This is hooked into 'after_setup_theme' so that the block editor is enabled by default but can be disabled by themes.
2690functionadd_theme_support($feature,...$args){2691global$_wp_theme_features;26922693if(!$args){2694$args=true;2695}26962697switch($feature){2698case'post-thumbnails':2699// All post types are already supported.2700if(true===get_theme_support('post-thumbnails')){2701return;2702}27032704/*2705 * Merge post types with any that already declared their support2706 * for post thumbnails.2707 */2708if(isset($args[0])&&is_array($args[0])&&isset($_wp_theme_features['post-thumbnails'])){2709$args[0]=array_unique(array_merge($_wp_theme_features['post-thumbnails'][0],$args[0]));2710}27112712break;27132714case'post-formats':2715if(isset($args[0])&&is_array($args[0])){2716$post_formats=get_post_format_slugs();2717unset($post_formats['standard']);27182719$args[0]=array_intersect($args[0],array_keys($post_formats));2720}else{2721_doing_it_wrong(2722"add_theme_support( 'post-formats' )",2723__('You need to pass an array of post formats.'),2724'5.6.0'2725);2726returnfalse;2727}2728break;27292730case'html5':2731// You can't just pass 'html5', you need to pass an array of types.2732if(empty($args[0])||!is_array($args[0])){2733_doing_it_wrong(2734"add_theme_support( 'html5' )",2735__('You need to pass an array of types.'),2736'3.6.1'2737);27382739if(!empty($args[0])&&!is_array($args[0])){2740returnfalse;2741}27422743// Build an array of types for back-compat.2744$args=array(0=>array('comment-list','comment-form','search-form'));2745}27462747// Calling 'html5' again merges, rather than overwrites.2748if(isset($_wp_theme_features['html5'])){2749$args[0]=array_merge($_wp_theme_features['html5'][0],$args[0]);2750}2751break;27522753case'custom-logo':2754if(true===$args){2755$args=array(0=>array());2756}2757$defaults=array(2758'width'=>null,2759'height'=>null,2760'flex-width'=>false,2761'flex-height'=>false,2762'header-text'=>'',2763'unlink-homepage-logo'=>false,2764);2765$args[0]=wp_parse_args(array_intersect_key($args[0],$defaults),$defaults);27662767// Allow full flexibility if no size is specified.2768if(is_null($args[0]['width'])&&is_null($args[0]['height'])){2769$args[0]['flex-width']=true;
History
Introduced in 2.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.6.0
The editor-spacing-sizes feature was added.from the docblock
6.5.0
The appearance-tools feature enables a few design tools for blocks, see WP_Theme_JSON::APPEARANCE_TOOLS_OPT_INS for a complete list.from the docblock
6.3.0
The border feature allows themes without theme.json to add border styles to blocks.from the docblock
6.3.0
The link-color feature allows to enable the link color setting.from the docblock
6.1.0
The disable-layout-styles feature disables the default layout styles.from the docblock
6.1.0
The block-template-parts feature allows to edit any reusable template part from site editor.from the docblock
6.0.0
The html5 feature warns if no array is passed as the second parameter.from the docblock
5.8.0
The block-templates feature indicates whether a theme uses block-based templates.from the docblock
5.8.0
The widgets-block-editor feature enables the Widgets block editor.from the docblock
5.6.0
The post-formats feature warns if no array is passed as the second parameter.from the docblock
5.5.0
The custom-logo feature now also accepts 'unlink-homepage-logo'.from the docblock
5.5.0
The core-block-patterns feature was added and is enabled by default.from the docblock
5.4.0
The disable-custom-gradients feature limits to default gradients or gradients added through editor-gradient-presets theme support.from the docblock
5.3.0
Formalized the existing and already documented ...$args parameter by adding it to the function signature.from the docblock
5.3.0
The html5 feature now also accepts 'script' and 'style'.from the docblock
5.0.0
The responsive-embeds, align-wide, dark-editor-style, disable-custom-colors, disable-custom-font-sizes, editor-color-palette, editor-font-sizes, editor-styles, and wp-block-styles features were added.from the docblock
4.7.0
The starter-content feature was added.from the docblock
4.5.0
The customize-selective-refresh-widgets feature was added.from the docblock
4.1.0
The title-tag feature was added.from the docblock
3.9.0
The html5 feature now also accepts 'gallery' and 'caption'.from the docblock
3.6.1
The html5 feature requires an array of types to be passed. Defaults to 'comment-list', 'comment-form', 'search-form' for backward compatibility.from the docblock
3.6.0
The html5 feature was added.from the docblock
3.4.0
The custom-header-uploads feature was deprecated.from the docblock
2.9.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.