WordPress Multisite – global categories

function __add_global_categories( $term_id ) { if ( get_current_blog_id() !== BLOG_ID_CURRENT_SITE || ( !$term = get_term( $term_id, ‘category’ ) ) ) return $term_id; // bail if ( !$term->parent || ( !$parent = get_term( $term->parent, ‘category’ ) ) ) $parent = null; global $wpdb; $blogs = $wpdb->get_col( “SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = ‘{$wpdb->siteid}'” ); foreach … Read more