我正在使用这个代码,它工作得很好,但如果我激活子主题,它就不工作了。我该如何解决?
add_filter( \'template_include\', \'wpse_template_include\' );
function wpse_template_include( $template ) {
    // Handle taxonomy templates.
    $taxonomy = get_query_var( \'taxonomy\' );
    if ( is_tax() && $taxonomy ) {
        $file = get_theme_file_path() . \'/template-parts/taxonomies/taxonomy-\' . $taxonomy . \'.php\';
        if ( file_exists( $file ) ) {
            $template = $file;
        }           
}
return $template;