The term “block theme” is used a lot in WordPress but it was never really clear to me what that meant exactly from a code point of view.
While researching The post editor is going full iframe: what block developers need to know before WordPress 7.1, I learned that the outcome of testing WordPress 7.1 Beta 1 may soften the plan: instead of forcing the iframe for everyone, core might force it only for block themes, while classic themes using blocks with apiVersion 2 or lower keep the current 7.0 behavior. (The linked article covers the 7.0 state of things in full.)
If that’s the split, then the exact definition of “block theme” suddenly matters a great deal. So what does core actually check?
The public API is wp_is_block_theme(), which just asks the active theme:
// wp-includes/theme.php (guard clause trimmed)
function wp_is_block_theme() {
return wp_get_theme()->is_block_theme();
}
And WP_Theme::is_block_theme() is, in its entirety, a file-existence check:
// wp-includes/class-wp-theme.php (caching trimmed)
public function is_block_theme() {
$paths_to_index_block_template = array(
$this->get_file_path( '/templates/index.html' ),
$this->get_file_path( '/block-templates/index.html' ),
);
foreach ( $paths_to_index_block_template as $path ) {
if ( is_file( $path ) && is_readable( $path ) ) {
return true;
}
}
return false;
}
A theme is a “block theme” if it ships an index.html block template, either in templates/, or in block-templates/, the pre-5.9 legacy location. Nothing else is consulted. That has a few consequences that may surprise people:
theme.json doesn’t make you a block theme. Neither do patterns, block template parts, or add_theme_support( 'block-templates' ). A theme can adopt every one of those “hybrid” features and still land on the classic side of this check, because the test only looks for a top-level index.html template.
Child themes inherit the answer. get_file_path() looks in the child theme first and falls back to the parent, so a child theme of a block theme is a block theme even if the child ships no templates of its own.
It’s a filesystem check, not a declaration. There’s no header in style.css that opts you in or out. Drop a templates/index.html into a theme and, as far as WordPress is concerned, it is a block theme.
The minimum files required for block and classic themes
This is the entire minimum viable block theme — two files:
my-block-theme/
├── style.css ← standard theme header
└── templates/
└── index.html ← this file IS the decider
(WordPress considers a theme valid if it has style.css plus either index.php or templates/index.html, which means for a block theme, index.php, functions.php, and even theme.json are all optional.)
And this is a theme that is guaranteed to stay classic:
my-classic-theme/
├── style.css
└── index.php ← the classic fallback template
Staying on the classic side of the check comes down to two conditions:
- No
templates/index.htmland no legacyblock-templates/index.html. Other block templates don’t matter: a theme with `templates/single.html` but no `templates/index.html` still tests as classic. (In practice, though, if you’re shipping block templates, ship the index and be a block theme on purpose.) - No block-theme parent. The check falls back to the parent theme, so a child of Twenty Twenty-Five is a block theme no matter what the child contains. To be classic, the whole chain has to be.
Everything else is fair game. theme.json, patterns, add_theme_support( 'block-template-parts' )` custom templates registered from plugins — none of them flip the switch., patterns, add_theme_support( 'block-template-parts' ), custom templates registered from plugins: none of them flip the switch.
Where real themes land
Running that check against some current releases from the theme directory
| Tests classic | Tests block |
|---|---|
| Twenty Twenty-One and every earlier default | Twenty Twenty-Two and every later default |
Astra, Kadence, Blocksy, Botiga, Sydney, Hello Elementor — all ship theme.json |
|
| GeneratePress, Neve, OceanWP, Storefront |
Six of the themes in the first column ship theme.json, the marquee “block” feature, and still test classic, because the check never looks at theme.json
Twenty Twenty and OceanWP are another good gotcha: both ship a templates/ directory and are still classic, because it’s full of PHP page templates (template-cover.php, landing.php). The check wants templates/index.html specifically, so “does it have a templates folder” is not the indicator you might assume.
How the editor reads it
On the JavaScript side, the block-theme flag surfaces in two different places, which is worth knowing if you go source-diving.
As an editor setting:
// wp-includes/block-editor.php, get_block_editor_settings()
$editor_settings['__unstableIsBlockBasedTheme'] = wp_is_block_theme();
and on the REST themes endpoint, which is where @wordpress/core-data picks it up:
// wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
$data['is_block_theme'] = $theme->is_block_theme();
The one-file switch
For all the weight the term carries, “block theme” boils down to a single file: templates/index.html exists, or it doesn’t. Not theme.json, not patterns, not any amount of hybrid adoption. Just one index template, checked up the parent chain.
That’s worth keeping in mind if 7.1 does end up drawing the iframe line at wp_is_block_theme(). A hybrid theme that has adopted everything except block templates would keep the classic editor behavior, while adding a single templates/index.html (even accidentally, even in a parent theme you don’t control) would flip a site to the forced iframe. If your theme or your users’ sites sit anywhere near that line, now is a good time to check which side of it you’re actually on: it’s one is_file() call away.
Discover more from Complete Nursing Solution
Subscribe to get the latest posts sent to your email.
Votre site est rapide et fluide.
Je partage votre article sur les réseaux sociaux.
Do you have any tutorials available?
Avez-vous des disponibilités pour un projet ?
Great article, thanks for sharing!
I am curious to learn more about you.
Do you have any promotional offers?
I would like to subscribe to your blog.
I am a big fan of your work.
Je partage votre article sur les réseaux sociaux.
I see that you are using WordPress.
J’adore la navigation de votre site.
Could you give me more details?
Votre expertise est impressionnante.
J’aimerais collaborer avec vous.
Je trouve votre approche très intéressante.
Avez-vous une version mobile de votre site ?
I really appreciate your content.
Votre site est très professionnel.
Je suis intéressé par vos services.
I am curious to learn more about you.
I completely agree with your analysis.
Congratulations on your website!
Do you have additional sources to share?
I love your site’s navigation.
Do you have any upcoming events?
Je peux vous aider à améliorer votre SEO.
Votre site est très professionnel.
Votre site est très professionnel.
J’aimerais collaborer avec vous.
I am curious to learn more about you.
Would you like a free SEO audit?
Are you planning to add an online store?
Proposez-vous des services de rédaction ?
Pouvez-vous me faire un devis ?
I am a big fan of your work.
Continuez comme ça.
I recommend your site to my colleagues.
I am curious to learn more about you.
I am interested in your services.
I am a big fan of your work.
Je recommande votre site à mes collègues.
Your blog is a goldmine of information.
Hello, I am contacting you.
Avez-vous des disponibilités pour un projet ?
Hello, I am impressed by your WordPress website.
Your site is fast and smooth.
Do you have additional sources to share?
Continuez à produire du contenu de qualité.
I look forward to reading your next articles.
Do you need help managing your plugins?
Your website is very beautiful!
Do you have additional sources to share?
I see that you are using WordPress.
Votre site est très beau !
Je peux vous aider à améliorer votre SEO.
Avez-vous une newsletter ?
Pouvez-vous me faire un devis ?
Très bon article, merci pour le partage !
Je partage votre article sur les réseaux sociaux.
I would be happy to make you a proposal.
Avez-vous des sources supplémentaires à partager ?
Je souhaite m’abonner à votre blog.
I would like to subscribe to your blog.
Félicitations pour votre site !
Je recommande votre site à mes collègues.
Do you have additional sources to share?
Do you have any tutorials available?
Pouvez-vous me faire un devis ?
Keep producing quality content.
I find your approach very interesting.
Pouvez-vous me faire un devis ?
Do you need help with your website security?
Do you need help managing your plugins?
Your expertise is impressive.