我找到了一个解决方案-
// even before any taxonmy/terms are initialized, we reset the tables
add_action( \'init\', \'the_dramatist_change_tax_terms_table\', 0 );
// on blog switching, we need to reset it again, so it does not use current blog\'s tax/terms only
// it works both on switch/restore blog
add_action( \'switch_blog\', \'the_dramatist_change_tax_terms_table\', 0 );
function the_dramatist_change_tax_terms_table(){
global $wpdb;
// change terms table to use main site\'s
$wpdb->terms = $wpdb->base_prefix . \'terms\';
// change taxonomy table to use main site\'s taxonomy table
$wpdb->term_taxonomy = $wpdb->base_prefix . \'term_taxonomy\';
// if you want to use a different sub sites table for sharing, you can replca e$wpdb->vbase_prefix with $wpdb->get_blog_prefix( $blog_id )
}
此代码使所有分类法术语(不是分类法,只是术语)成为全局的。我明白了
here. 这些术语可以从任何子站点添加,并且根据子站点当前可用的分类法(注册分类法),这些术语将在那里可用。