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

Category post count is not correct

You’re a post type that doesn’t exist, there is no Post post type, did you mean post? Sidenotes: wp_reset_query is only for use after query_posts you should be using wp_reset_postdata instead. There is no if ( $loop->have_posts() ) check so if no posts are found there is no message and it looks like the page … Read more