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
init
action so later terms can be inserted
onafter_switch_theme
action.
Related Posts:
- install.php Custom Taxonomy Term not being added to custom post
- get_terms by custom post type
- Get terms by taxonomy AND post_type
- 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
- WPML with WP_Query serving up all 3 languages [closed]
- 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?
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Custom Post Type, WP_Query and ‘orderby’
- Get terms that contain posts that in turn belong to other terms?
- Templates for Custom Post Types and Custom Taxonomies
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Prev / Next Post Same taxonomy Custom Post Type
- 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
- Adding a Section for Visitors
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- Custom Post Type / Taxonomy / Term – what template to use to avoid 404-page?
- Pages of my taxonomy terms are showing all posts
- Display title of all custom posts from same taxonomy term on a custom post template
- wordpress does not see the correct custom taxonomy hierarchy
- Add active class to foundation 6 tabs while looping categories
- Saving Child Terms on front end not setting parent
- How to show terms used only for particular custom post type. Filter creation perpose
- Get category list & taxonomy list from different post type using post id?
- How to get all posts related to a taxonomy?
- how it’s possible to show from a post of a custom post type the taxonomy/terms?
- Custom taxonomy- only output relevant terms
- order taxonomy alphabetical
- Custom Post – additional param in the custom post URL goes to error page
- Filter Term By Parent Term – Custom Post Type
- Filter By Term Not Working – Custom Post Type
- Display all Custom taxonomy terms and their relevant custom posts
- Displaying the Taxonomy and a Queried Term on a taxonomy.php page?
- Main site single-property.php design, as homepage of a multisite
- WordPress get all post with like in terms [duplicate]
- Get posts of an specific term of a custom taxonomy
- WordPress add taxonomies/terms list as a menu in archive page
- Decrement term in for each
- Best way to group posts based on custom post type terms
- Hide Custom Taxonomy title if not associated with another Custom Taxomony
- How to pass taxonomy terms to WP_Query along with $args?
- Custom Post Status & Taxonomies
- Get list of CPT posts in *current* post’s taxonomy term
- Shared Custom post type between WP network sites
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- Create an additional template page for every term taxonomy
- Prevent repetitive terms in get_the_term_list
- Issue on Counting CPT’s Under Taxonomy Term
- How to List CPTs Under One Tax Term
- How to retrieve the permalink for a specific (custom) term?
- Exclude Custom Post Type from shared Custom Taxonomy
- Taxonomy Grid Archive Help?
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Get a list of categories ids
- Multisite – Echo admins profile meta
- Using get_terms() as shortcode attribute
- Get term_id for each instance of custom taxonomy
- Custom post type URL returns 404 error page
- List a custom taxonomy’s terms, with links, on the taxonomy page
- taxonomy terms array not working
- List a custom post type’s posts ordered by nested custom taxonomy
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- How to add a post counter to the list of custom taxonomy terms?
- Author template – separate custom post type by custom taxonomy term for $curauth
- get_the_term_list() wanting to loop through the returned values
- List custom taxonomy terms
- show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- Navigation links to posts in current term shortcode
- Display associated taxonomy child name on single CPT page
- How to manage a bookstore
- Get all terms assigned to a post from different taxonomies
- 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
- Custom post type single page fine for admin, 404 from front
- Taxonomy Archive URL + Template
- Can Multisite and Custom Post Types work this way?
- Search and filter terms of a custom post type only and display results
- Get a custom post type’s taxonomy type term names displayed as checkboxes and filter
- Display posts from Custom Post Type, group by term, arrange term groups and arrange items within groups by menu order
- Is it possible to get_terms by taxonomy AND post_type?
- How to list custom taxonomy terms without the hyperlinks?
- Multisite permalink issue
- Is there a way to edit non-custom term attributes?
- Can’t retrieve custom post type taxonomy term to custom post type editor
- How to determ a custom post type url?
- Adding a new custom post type using the editor causes 502 bad gateway error
- Change the WordPress database prefix on the fly?
- Change the WordPress database prefix on the fly?