在WP 3.4中,他们允许添加模板文件one level deep.
从那时起,代码发生了变化,但是wp-includes/class-wp-theme.php, 在里面offsetGet() (来自__get()) 您将看到:
case \'Template Files\' :
$files = $this->get_files( \'php\', 1 );
虽然我无法完全解开加载主题的代码迷宫,但上面提出了第二个论点,
$depth, 仍设置为“仅”
1 深为
Template Files. 这与你所经历的麻烦不谋而合。
您可能需要重新考虑主题文件夹结构和/或选择模板的逻辑。
如果首先要有条件地检查基于用户选择选择的模板,请在您的条件下使用load_template() 和或template_redirect() 可能比让Wordpress默认设置更有用。