Filter to Remove Starter Templates Button on Post Types

Filter to Remove Starter Templates Button on Post Types

If you are looking to remove the Starter Templates button visible on the top of the Pages/Posts of your website.

You can insert the following filter in your child theme’s functions.php file (How?) –

You can insert the following filter –

1) To disable the Gutenberg Templates button from all post types.

add_filter( ‘ast_block_templates_disable’, ‘__return_true’ );

2) To disable the Gutenberg Templates button for Page post type.

add_filter( ‘ast_block_templates_disable’, function( $default = false ) {
if( isset( $_REQUEST[‘post_type’] ) && ‘page’ === $_REQUEST[‘post_type’] ) {
return true;
} return $default;
} );

Note:

Please add the required code to the functions.php of your child theme.Refer to this doc on How to Add Custom Code to the Child theme?