Title: wp_enable_block_templates
Published: July 20, 2021
Last modified: August 20, 2026

---

# wp_enable_block_templates()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Enables the block templates (editor mode) for themes with theme.json by default.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#source)󠁿

    ```php
    function wp_enable_block_templates() {
    	if ( wp_is_block_theme() || wp_theme_has_theme_json() ) {
    		add_theme_support( 'block-templates' );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/theme-templates.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/theme-templates.php#L138)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/theme-templates.php#L138-L142)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_theme_has_theme_json()](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/)`wp-includes/global-styles-and-settings.php` |

Checks whether a theme or its parent has a theme.json file.

  | 
| [wp_is_block_theme()](https://developer.wordpress.org/reference/functions/wp_is_block_theme/)`wp-includes/theme.php` |

Returns whether the active theme is a block-based theme or not.

  | 
| [add_theme_support()](https://developer.wordpress.org/reference/functions/add_theme_support/)`wp-includes/theme.php` |

Registers theme support for a given feature.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enable_block_templates%2F)
before being able to contribute a note or feedback.