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