diff --git wp-admin/theme-editor.php wp-admin/theme-editor.php
index 03b91944ea..24de2991f2 100644
|
|
$file_types = array_unique( array_merge( $file_types, $default_types ) ); |
81 | 81 | foreach ( $file_types as $type ) { |
82 | 82 | switch ( $type ) { |
83 | 83 | case 'php': |
84 | | $allowed_files += $theme->get_files( 'php', 1 ); |
| 84 | $allowed_files += $theme->get_files( 'php', apply_filters( 'wp_theme_scandir_depth', 1, 'php', $theme ) ); |
85 | 85 | $has_templates = ! empty( $allowed_files ); |
86 | 86 | break; |
87 | 87 | case 'css': |
88 | | $style_files = $theme->get_files( 'css' ); |
| 88 | $style_files = $theme->get_files( 'css', apply_filters( 'wp_theme_scandir_depth', 0, 'css', $theme ) ); |
89 | 89 | $allowed_files['style.css'] = $style_files['style.css']; |
90 | 90 | $allowed_files += $style_files; |
91 | 91 | break; |
92 | 92 | default: |
93 | | $allowed_files += $theme->get_files( $type ); |
| 93 | $allowed_files += $theme->get_files( $type, apply_filters( 'wp_theme_scandir_depth', 0, $type, $theme ) ); |
94 | 94 | break; |
95 | 95 | } |
96 | 96 | } |
diff --git wp-includes/class-wp-theme.php wp-includes/class-wp-theme.php
index 0da9b5ea11..8fe2e9f72c 100644
|
|
final class WP_Theme implements ArrayAccess { |
468 | 468 | case 'Stylesheet' : |
469 | 469 | return $this->get_stylesheet(); |
470 | 470 | case 'Template Files' : |
471 | | return $this->get_files( 'php', 1, true ); |
| 471 | return $this->get_files( 'php', apply_filters('wp_theme_scandir_depth', 1, 'php', $this ), true ); |
472 | 472 | case 'Stylesheet Files' : |
473 | | return $this->get_files( 'css', 0, false ); |
| 473 | return $this->get_files( 'css', apply_filters('wp_theme_scandir_depth', 0, 'css', $this ), false ); |
474 | 474 | case 'Template Dir' : |
475 | 475 | return $this->get_template_directory(); |
476 | 476 | case 'Stylesheet Dir' : |
… |
… |
final class WP_Theme implements ArrayAccess { |
1003 | 1003 | if ( ! is_array( $post_templates ) ) { |
1004 | 1004 | $post_templates = array(); |
1005 | 1005 | |
1006 | | $files = (array) $this->get_files( 'php', 1 ); |
| 1006 | $files = (array) $this->get_files( 'php', apply_filters('wp_theme_scandir_depth', 1, $type, $this ) ); |
1007 | 1007 | |
1008 | 1008 | foreach ( $files as $file => $full_path ) { |
1009 | 1009 | if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { |