I am not sure how you are activating theme on Network but here I am considering a case of installing fresh theme on a existing Network.
Activating theme on any single site will insert the term for every site in Network but yes of course taxonomy registration code should be there already.
Consider this example
function after_switch_theme_callback() {
$blogs = wp_get_sites(); //Array of site Ids
foreach ($blogs as $blog) {
if (!empty($blog['blog_id'])) {
switch_to_blog($blog['blog_id']);
wp_insert_term('myTerm '.$blog['blog_id'], 'genre');
restore_current_blog();
}
}
}
add_action('after_switch_theme', 'after_switch_theme_callback');
It seems to me working fine.
Note:
Register your taxonomy on
initaction so later terms can be inserted
onafter_switch_themeaction.
Related Posts:
- install.php Custom Taxonomy Term not being added to custom post
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Get The Post Type A Taxonomy Is Attached To
- Display current taxonomy term when inside custom post type
- Get term slug of current post
- How to limit the number of terms (terms acts like categories)
- How do I list custom taxonomy terms without the links?
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Multisite wide post type?
- wp_get_object_terms(): count relative to passed IDs?
- Count posts that have specific taxonomy term attached
- display multiple term post from taxonomy in a single page
- Maintaining strict one-to-one association between terms and custom posts
- If on term-page -> get the current term?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- WPMU: Programmatically adding CPT posts to specific blog id
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Output the slug and name of a CPT single post taxonomy term
- Get all taxonomies for all post types
- How do I provide a “show all posts” link in a paginated term archive?
- Rewrite Custom Post Type URL slug
- Multisite Global Custom Posts
- Multisite custom post type’s single page 404
- How to output wordpress custom tags separated by comma?
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Custom Taxonomy Invalid in REST API
- get_post_meta returns empty array for terms
- Custom Post Type Archive Page Filtering
- Filtering WP_Query Dynamically on the Front-End
- Get template part using a custom taxonomy term
- Get posts by querying taxonomy and certain terms of the taxonomy?
- How to restrict users and admin from creating new taxonomy terms?
- How to set up multisite for multi language?
- Displaying custom taxonomy in the admin list of a custom post type
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- How do I display the taxonomy term alongside the post type post title?
- Custom post taxonomies as tax_query terms?
- Post count by month of taxonmy term
- How do I display the taxonomy for a custom post type in an array
- WPMU: Cross site custom post type
- Custom Post, set object Taxonomy terms in plugin
- How to include term custom meta into the custom taxonomy term permalink structure
- Setup template_redirect using has_term when NO term assigned
- Custom while loop for hierarchical display of a taxonomy
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- Multisite: How to define and limit a Custom Post Type to specific sites?
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Add term to custom post type on draft
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- return only the first two terms of custom post
- Category archive in with conjunction with custom post type is empty
- Add arguments to get_the_terms for custom post types
- How to Display Posts From Category Within a Custom Taxonomy?
- The Difference Between Categories and Tags and Taxonomies and Terms
- Assigning alternate single-{cpt} template based on blog_id in multisite
- WordPress multisite – is it possible to have different taxonomies for each site?
- Is there SEO or related limitations to using Custom Post Types instead of WPMU?
- How to migrate Custom Field Template to a WordPress Multisite
- how to count the current posts terms
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Commas not displaying in implode
- How can I get 3 different taxonomy type terms in a div class element?
- Get terms for a specfic post from multiple taxonomies in custom post type
- Custom Post Type Taxonomy Term Order by Title
- Add custom post type taxonomy tag to article class
- Custom Taxonomy dont save in a frontend form for post a custom post
- Get_the_term_list inexplicably adds values in foreach
- Get List of Terms based on a given term (different taxonomy)
- display post count in archive page that have relation with another taxonomy term
- get taxonomies from terms
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Get all posts for custom taxonomy term
- posts_per_page is not working by term
- wp_set_post_terms not updating with WP Cron Event
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- Add active class to foundation 6 tabs while looping categories
- Saving Child Terms on front end not setting parent
- how it’s possible to show from a post of a custom post type the taxonomy/terms?
- Filter By Term Not Working – Custom Post Type
- Get posts of an specific term of a custom taxonomy
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- How to List CPTs Under One Tax Term
- Get a list of categories ids
- Using get_terms() as shortcode attribute
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- List custom taxonomy terms
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- Fatal Error WordPress Custom Post Type UI + WPML
- Create WP multisites as a custom post type
- Get term link of shared taxonomy between multiple post types
- How to use wp_set_object_terms depending on page ID?
- Rewrite rule taxonomy url with different values in one function
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php
- Search and filter terms of a custom post type only and display results
- How to list custom taxonomy terms without the hyperlinks?