Skip to content
wp-skills
Register
tools/add-theme-support-generator

Add Theme Support Generator

Declare what your theme supports in one after_setup_theme callback: featured images, HTML5 markup, post formats, a custom logo and the block editor's appearance tools — each emitted once, in the shape WordPress actually reads.

Features

Everything here takes no arguments. Title tag is the one WordPress refuses to register late — after wp_loaded it is dropped, which is why this all runs on after_setup_theme.

Emitted as exactly one call: once post-thumbnails is registered for everything, a later scoped call is silently ignored.

One call, because a second one merges into the first without removing duplicates.

WordPress only reads five of these — search form, comment form, comment list, gallery and caption. Style and script are in core's own default and are read by nothing; they are here because the handbook lists them.

Needs at least one format: WordPress refuses the call outright without a list.

Standard is not offered — a post with no format already is one.

What the Customizer and the Site Logo block read.

add_editor_style() registers the editor-style feature itself, so it is not listed above.

Relative to the theme directory.

snippet.php
<?php
/**
 * Theme support
 *
 * Generated by wp-skills.com
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Declares what this theme supports.
 *
 * Two things about where and when this runs.
 *
 * On after_setup_theme, and that is not a stylistic choice. WordPress reads
 * most of these while it builds the admin and the front end, and one of them
 * refuses to register late outright: add_theme_support( 'title-tag' ) called
 * after wp_loaded raises _doing_it_wrong() and returns false, leaving
 * current_theme_supports( 'title-tag' ) false and the theme without a <title>.
 *
 * And in the theme's functions.php rather than a plugin. Every callback on
 * after_setup_theme runs in registration order, and a theme's functions.php is
 * loaded after every plugin — so the theme's own calls run last and win.
 * Measured: a theme declaring a plain post-thumbnails overrides a plugin's
 * scoped one, and a theme's post-formats list replaces a plugin's outright.
 */
function wp_skills_theme_setup() {
	add_theme_support( 'title-tag' );
	add_theme_support( 'automatic-feed-links' );
	add_theme_support( 'menus' );
	add_theme_support( 'responsive-embeds' );

	add_theme_support( 'post-thumbnails' );

	add_theme_support(
		'html5',
		array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
			'style',
			'script',
		)
	);
}
add_action( 'after_setup_theme', 'wp_skills_theme_setup' );