diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php index 61ae17cc1c0e4..bd8dfeefb2dea 100644 --- a/src/wp-includes/block-template-utils.php +++ b/src/wp-includes/block-template-utils.php @@ -229,14 +229,12 @@ function _get_block_templates_paths( $base_directory ) { return $template_path_list[ $base_directory ]; } $path_list = array(); - try { + if ( is_dir( $base_directory ) ) { $nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH ); foreach ( $nested_html_files as $path => $file ) { $path_list[] = $path; } - } catch ( Exception $e ) { - // Do nothing. } $template_path_list[ $base_directory ] = $path_list; return $path_list;