wp_enable_block_templates()
Enables the block templates (editor mode) for themes with theme.json by default.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
null. Nothing (null).
Usage
wp_enable_block_templates();
Changelog
| Since 5.8.0 | Introduced. |
wp_enable_block_templates() wp enable block templates code WP 6.9
function wp_enable_block_templates() {
if ( wp_is_block_theme() || wp_theme_has_theme_json() ) {
add_theme_support( 'block-templates' );
}
}