如何在child_theme之前加载parent_theme functions.php?
我遇到的问题是,我必须先加载父主题的functions.php文件,然后再functions.php加载子主题的文件。这是设置和初始化过程所必需的。我查看了/wp_core_root/wp-settings.php(名为:)中的钩子do_action('setup_theme');。 问题是我不知道该如何挂钩,因为我得到的第一个文件是子主题的functions.php,所以没有用add_action( 'setup_theme', 'my_init_function' );。 编辑: a)我知道插件的加载早于主题加载,因此甚至可以访问初始查询,但是我不想依赖插件。 b)这是wp-settings.php文件中的代码(缩短了) // happens a lot earlier: do_action( 'plugins_loaded' ); // localize stuff happening here do_action( 'setup_theme' ); // Load the functions for the active theme, for both parent and child theme if applicable. if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' …