Theme Support Generator
The setup block every theme needs, with the feature flags you chose and the arguments each one really accepts — plus the image sizes and menus that belong beside them.
<?php // Generated with WP CodeKit — powered by GrowQuest (https://growquest.io). // Add to your theme's functions.php. /** * Declare what this theme supports. */ function mytheme_setup() { load_theme_textdomain( 'mytheme', get_template_directory() . '/languages' ); add_theme_support( 'title-tag' ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', ) ); add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'wp-block-styles' ); add_theme_support( 'align-wide' ); add_theme_support( 'responsive-embeds' ); add_theme_support( 'custom-logo', array( 'height' => 60, 'width' => 240, 'flex-height' => true, 'flex-width' => true, ) ); add_theme_support( 'editor-styles' ); add_editor_style( 'assets/css/editor.css' ); set_post_thumbnail_size( 1200, 675, true ); add_image_size( 'card-thumb', 640, 360, true ); add_image_size( 'hero-wide', 1600, 700, true ); } add_action( 'after_setup_theme', 'mytheme_setup' ); /** * Set the content width for oEmbeds and wide images. */ function mytheme_content_width() { $GLOBALS['content_width'] = apply_filters( 'mytheme_content_width', 1200 ); } add_action( 'after_setup_theme', 'mytheme_content_width', 0 ); /** * Offer the custom sizes in the editor’s image size dropdown. * * @param array $sizes Size name => label. * @return array */ function mytheme_image_size_names( $sizes ) { return array_merge( $sizes, array( 'card-thumb' => __( 'card-thumb', 'mytheme' ), 'hero-wide' => __( 'hero-wide', 'mytheme' ), ) ); } add_filter( 'image_size_names_choose', 'mytheme_image_size_names' );
About this generator
add_theme_support() Generator Online
Pick the features your theme declares and get one tidy after_setup_theme callback containing every add_theme_support() call, the text domain loader, set_post_thumbnail_size(), your add_image_size() registrations and the image_size_names_choose filter that puts those sizes in the editor dropdown. Features that take arguments — html5, custom-logo, post-formats, custom-header, custom-background — are written with sensible argument arrays rather than as bare one-liners.
Presets for a classic theme, a block theme and a bare minimum set get you to a realistic starting point in one click, and the Checks tab tells you which omissions a theme reviewer would actually object to. Free, no account, nothing uploaded.
Reviewed Output tested on WordPress 6.8 · PHP 8.3
Why the add_theme_support generator beats pasting feature flags one at a time
Most add_theme_support() snippets are copied individually and end up scattered across functions.php, half of them hooked to the wrong action. The function only works when it runs on after_setup_theme — on init it is already too late for several features. And the flags interact: image sizes are useless without post-thumbnails, editor-styles does nothing without an add_editor_style() call, and appearance-tools makes three other flags redundant. This tool writes them as one coherent setup function and checks the combinations.
One setup function, correctly hooked
Everything lands inside a single prefix_setup() callback on after_setup_theme, starting with load_theme_textdomain() against get_template_directory() . '/languages' — the placement theme reviewers expect.
Arguments written out, not left as TODOs
html5 gets the full array of search form, comment form, comment list, gallery, caption, style and script. custom-logo gets height, width and both flex flags. post-formats, custom-header and custom-background come with real starting arrays.
Image sizes checked against core
Registering a size called thumbnail, medium, medium_large, large or full is an error — it silently changes core behaviour site-wide. Duplicate names, sizes with no dimensions, crop with only one dimension and widths above the 2560px upload cap are all flagged.
Dependencies between features enforced
Image sizes without post-thumbnails is an error, and so is woocommerce support without it, because product images need it. set_post_thumbnail_size() without the feature is a warning, since it does nothing.
Redundancy called out
appearance-tools already includes line height, spacing and custom units, so listing those flags alongside it is flagged with a one-click "drop the extras". custom-background is noted as a pre-block-editor feature most modern themes handle in theme.json instead.
The editor dropdown filter you would otherwise forget
Custom sizes registered with add_image_size() do not appear in the editor's image size dropdown on their own. Add one and the generator writes the image_size_names_choose filter with translated labels alongside it.
How does the Theme Support Generator work?
Four steps. Start from a preset rather than a blank list — it is far easier to remove a flag than to remember one.
- 01
Pick the theme kind
Classic theme, block theme or bare minimum. Each preset selects a realistic set of features; the block preset swaps the widget selective-refresh flag for
appearance-tools. - 02
Choose the features
Toggle individual flags across three groups — essentials, editor and branding/media. Each one carries a short note about what it actually changes, so you are not selecting on the name alone.
- 03
Add image sizes
Set the featured-image size as width, height and crop, then register any additional named sizes. Reorder them by dragging; each becomes an
add_image_size()call plus a dropdown label. - 04
Set the content width, then export
Give
$GLOBALS['content_width']a value so oEmbeds have a maximum, clear the Checks tab, then copy the block or download it forfunctions.php.
Worked example — the bare-minimum set with a featured image size
Four features and a thumbnail size. Note that html5 is emitted with its argument array: passing the flag on its own does nothing in practice.
/**
* Declare what this theme supports.
*/
function mytheme_setup() {
load_theme_textdomain( 'mytheme', get_template_directory() . '/languages' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
)
);
set_post_thumbnail_size( 1200, 675, true );
}
add_action( 'after_setup_theme', 'mytheme_setup' );Add a content width and the generator appends a second callback on after_setup_theme at priority 0, setting $GLOBALS['content_width'] through a filter so a child theme can change it.
Theme support — frequently asked questions
The questions developers ask when a declared feature does not appear to do anything.
Why does add_theme_support() have no effect?
It is almost always the hook. add_theme_support() must run inside a callback attached to after_setup_theme; calling it on init, or at the top level of functions.php, is either too late or too early depending on the feature. A second common cause is calling it from a child theme at the default priority — the child's functions.php loads first, so the parent can overwrite what you set. Hook at priority 11 in a child theme.
What is the difference between add_image_size() and set_post_thumbnail_size()?
set_post_thumbnail_size() sets the dimensions used when you call the_post_thumbnail() with no size argument — there is one of these per theme. add_image_size() registers an extra named size you can then request by name. Both only generate files for images uploaded after the code is in place; existing images need a regeneration tool to get the new crops.
Do block themes still need add_theme_support()?
Much less than classic themes do. A block theme with a theme.json gets align-wide, responsive-embeds, editor styles and the whole appearance-tools set from that file instead, and WordPress opts block themes into several features automatically. What remains worth declaring in PHP is post-thumbnails, title-tag, automatic-feed-links, html5 and features with no theme.json equivalent such as custom-logo and post-formats.
Why is my editor stylesheet not loading?
add_theme_support( 'editor-styles' ) only turns the feature on. You still need add_editor_style( 'path/to/editor.css' ) pointing at a file that exists relative to the theme root. The generator writes both lines together for exactly this reason. Note that WordPress rewrites the selectors in that file to scope them to the editor canvas, so a rule written against body is scoped, not dropped.
What does content_width actually control?
It is a global that tells WordPress the maximum width in pixels that content can occupy, which oEmbed uses to size embedded videos and which some core functions use to constrain large images. Without it an embed has no maximum and can overflow a narrow layout. Set it on after_setup_theme at priority 0 so it exists before anything reads it, and expose it through a filter so a child theme can change it.
How many custom image sizes is too many?
Every registered size generates another file on every upload, on top of the five core already creates. Four or five custom sizes on a media library of any size becomes a real storage and backup cost, and the generator warns past that point. Prefer reusing one wide size with srcset over registering a near-duplicate for each template.
Where do I paste the code from the Theme Support generator?
You have three good options and one bad one. Best is a small site-specific plugin — the generator can output one for you, and it keeps working when you change theme. A code-snippets plugin is fine too. A child theme's functions.php works but ties the code to that theme. Never edit the parent theme: the next update overwrites it and your code is gone.
Can I use the generated code in client work or a commercial plugin?
Yes. The output is ordinary WordPress API calls that you configured — there is no licence attached to it and no attribution required. Use it in client sites, commercial plugins and themes, or products you sell. The generated file carries a short credit comment you are free to delete.
The other Design generators in the library, plus the WordPress tools most often used alongside this one.