Action Hook since 2.6.0

after_setup_theme

Fires after the theme is loaded, before init

Description

after_setup_theme is where themes declare support for core features — post thumbnails, menus, HTML5 markup — before WordPress finishes bootstrapping.

When it runs

After plugins_loaded, before init. Theme's functions.php has already run by this point.

Signature

do_action( 'after_setup_theme' );

Examples

Basic

add_action( 'after_setup_theme', function() {
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'title-tag' );
    register_nav_menus( [ 'primary' => 'Primary Menu' ] );
} );

Declare standard theme support and a nav menu location.

Common Use Cases

  • Declare add_theme_support() features
  • Register nav menu locations
  • Set content width
  • Load theme text domain

Common mistakes

  • Calling add_theme_support('post-thumbnails') on init — it works but is technically too late for some checks that run before init

Related hooks

FAQ

Can I use after_setup_theme in a plugin?

Yes, but it's primarily meant for themes. Plugins usually use plugins_loaded or init instead.

Source: wp-settings.php

Group wizard

One session: this hook, then each related_hooks entry. Walk it and tell us what to change.

after_setup_theme → init → widgets_init

functions.php — after_setup_theme
functions.php
PHP after_setup_theme · Hook 1 of 3 · Step 1 of 6

Practice the after_setup_theme WordPress action hook in our interactive sandbox — a VS Code-style editor with a step-by-step after_setup_theme tutorial, add_action exercises, and instant feedback. No local WordPress install required.