Duplicate new categories across multisite network
I think I figured it out. I had multiple things wrong with the code: function category_to_all( $term_id ){ remove_action( ‘create_category’, __FUNCTION__ ); $currentcatdata = get_term_by(‘id’, $term_id, ‘category’); $allsiteids = get_sites(array(‘fields’ => ‘ids’)); $currentsiteid = get_current_blog_id(); if (($key = array_search($currentsiteid, $allsiteids)) !== false) { unset($allsiteids[$key]); } $blog_ids = array_values($allsiteids); foreach( $blog_ids as $blog_id ) { switch_to_blog( … Read more