After looking through Make WordPress, it looks like this is a known issue that won’t be fixed due to scalability concerns with large networks.
That same issue linked above recommends doing exactly the solution discussed above. Specifically, that would look something like this:
public static function 145561_activate_new_blog($blog_id) {
if (is_plugin_active_for_network(plugin_basename(__FILE__))) {
// do activation for $blog_id
}
}
add_action('wpmu_new_blog', '145561_activate_new_blog');
Related Posts:
- Prevent network activation of plugin
- Only allow plugin to be activated on root site of multisite
- Custom Plugin activation error in Multisite
- How do I create a custom role capability?
- How to redirect to settings page once the plugin is activated?
- How to output message during plugin activation
- Inserting Taxonomy Terms During a Plugin Activation?
- Uninstall script for a plugin in Multisite
- Changing Plugin Load Order
- What is wrong with using add_option with Multisite instead of add_blog_option in a plugin
- How to Get a List of Sub Blogs without Using get_blog_list()?
- Cron firing my function everytime wp-admin is visited
- Using wp_cron with custom time interval and the register activation hook
- Error getting correct blog_id on MU from functions.php
- How do I make specific plugin functionality apply to different sites in a network?
- WordPress multisite apply different options over each site from same plugin
- Call activation hook multiple times
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- Multisite, sharing content by URL
- How to use wp_set_password in a plugin?
- WordPress Media mime type filter problem 4.0
- why creating tables using $wpdb is not being executed while installing plugins?
- Override pluggable functions in a plugin?
- Plugin activation error due to unexpected output
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Where should I store global data for my multi-site WordPress plugin?
- unable to stop loop when using wp_insert_post with publish_post hook
- Customize multisite site creation with user data
- Multisite plugin development and wp_enqueue_script
- Plugin Uninstall and Deactivate via Options Menu
- how to activate plugin network-wide, and save setting across sites
- Sharing a common set of image files for media library, across all sites within multisite
- What is difference between blog id and site id?
- Settings not set after calling register_setting()
- How to create a Tools menu on the Network Admin dashboard from a plugin
- Override the default Add/Edit site forms of the Network Panel in custom plugin
- How to set “Site Address (URL)” programmatically on WP multisite?
- How to associate an existing user to a site in a multisite setup programmatically
- WordPress Multisite with Azure B2C redirect_urls after Login
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- How To Change Post Author Default?
- Adding (blog-specific) links to “My Sites” admin page
- Plugin menu addition in multisite
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Multiple Plugin best practice in Multisite
- Selectively update themes in WordPress multisite
- Problem with context in multisite – getting main site data in every blog (get_pages())
- how to invoke wordpress API from other existing PHP system
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- register_activation_hook on multisite
- Add Link Category on Activation?
- WordPress Plugin Activate / Deactive Failing
- WordPress multisite,use same cookies across all website?
- WP: Search and replace in DB programmatically
- Multiple array for post_content on plugin activation
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- How to get current logged-in user details in multisite?
- add_action wp_ajax_ not loading in plugin file WP Network
- Plugin can’t be activated [closed]
- Activate / Deactivate plugin
- How to share user data across multiple WordPress websites?
- Is there anything special required to make a plugin work in a multisite environment?
- How to edit wp-signup.php content using plugin
- Activation flow of a plugin in a multisite environment
- How do I ensure I can loop through every enqueued script and CSS?
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Replace “content-area” of themes 404 page with plugin?
- Multisite and the JSON REST API: How to?
- How to store in the database directly the translation?
- Testing Plugins for Multisite
- Unable to show a message after plugin activation
- Same header/footer in Admin, across all network sites in multisite
- Refresh or redirect page after activate my plugin
- I can install my plugin in localhost but not in my server
- WordPress plugin tables become corrupt
- Change Admin menu placement using hooks
- Deactivate plugin on registration
- Force remove parent theme CSS/JS and call them from Child theme
- how can a plugin return an error message on activation?
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- My activator class isn’t running the code inside
- 2 Domains pointing to SIngle WordPress , issues with links
- REST Endpoint API 404
- add_action pre_term_description vs. pre_category_description
- How to check whether checkbox is checked in WordPress customizer
- How to create a wordpress widget that dynamically changes according to the page
- How to disable a jQuery plugin on WordPress plugin page
- jquery in wordpress plugin with depdendency
- Problem with autoloader and namespaces
- Non editable custom taxonomy
- How to Get Rid of Unwanted Backslashes in WordPress Form Input inside admin menu option
- Gutenberg – is it ok to load dependencies multiple times?
- Is it possible to use WP-CLI in a plugin (or theme)?
- Preventing double loading JS scripts (like React) when developing for Gutenberg
- Pass CF7 form data to plugin
- How to add custom post widgets as tags into wordpress
- How to display the specific post content by using POST ID
- Should I use wp-content/cache or [PLUGIN_DIR]/cache?
- How to register my code as a plugin
- Secruity Questions on a timer