The wpmu_new_blog
hook is indeed deprecated and shouldn’t be used; however, it works because it runs after the new site has been initialized (see wp_initialize_site()
) which means the database tables for that site has been created and filled with the default options.
So because you are updating the site’s options like default_comment_status
, then you should use the wp_initialize_site
hook and not wp_insert_site
:
add_action( 'wp_initialize_site', 'setup_multisite_action' ); // use this
//add_action( 'wp_insert_site', 'setup_multisite_action' ); // not this
Related Posts:
- How to add Custom Blog Options to new blog setup form?
- Add site options UI in Multisite Sites > Infos page
- Which action hook to update custom field at network/site-info.php in multisite on update site info
- Plugin for editing options on multisite?
- WordPress Multisite: Adding actions to only one site
- WP Multisite: Adding pages on blog creation by default
- differences between behavior get_option vs get_site_option in multisite
- Perform action on WPMU blog deletion
- How To Provide Sub-Blogs Their Own Domain Names?
- Multisite: How to store global options vs. site options?
- How do I share plugin settings across WordPress network?
- Blog Settings import/export in WordPress Network environment
- How to make WordPress use new Upload Path settings in Multisite Setup
- Hook filter to change wp_upload_dir() path in multisite
- What is the correct form action URL for network options pages?
- Using WP CLI to set options in WP Multisite
- Add New Sub Site from the WordPress back end then in sub site options table option_value must be with https
- WPMU Hook for archive or deactivate blog?
- Make default new sites https (multisite)
- How to update_site_option for specific site within network?
- WordPress (+WPMU) Import/Export ALL settings?
- Does WordPress MultiSite use separate MySql databases?
- Hook up MU site creation
- What are Attributes used for in a WordPress Multisite?
- Multisite Network menu links not updating
- How to get option values set from all sites within a Multisite setup?
- Bulk theme settings in wordpress multisite
- What is the function to get options of the parent site of a multisite network?
- wp-config dynamic hostname in WP_HOME and WP_SITEURL
- WordPress Network admin options page: how to store options and where will they be stored?
- ERR_TOO_MANY_REDIRECTS when i config my subdomains
- Register submenu on network menu from the subsite
- Why is MySQL receiving such a large serialized object?
- How do you update a network option value in the DB via a hook
- get_site_option / update_site_option – the main site and sub sites do not share the same storage
- Multisite Equivalent of `register_setting`?
- wp option get blogname –url=my-sub-site.com returning main site option
- Multisite – each site with it’s own set of users
- What could cause wpmu_create_blog to throw “Already Installed” Error on multisite?
- Update siteurl and home in multisite subsites to https
- multisite shared settings
- Multisite and plugins options
- personal_options hook on WordPress multisite
- How to display update message only to admin
- How to set an option for all sites in my Multisite network?
- How to use same email for multiple users
- Changing Plugin Load Order
- Mega WordPress Applications WPMU or otherwise
- Does the WordPress API work with multisite?
- wp_get_attachment_image_src multisite issue
- Transfer Subdomain site to Multisite setup
- WP REST API – Multisite – get posts from all sites
- Set default options for inserting media
- What is the best way to setup wordpress development environment for freelancers with version control?
- Trying to access second site dashboard on a multisite configuration proceeds to an error
- Get source from the_post_thumbnail
- WordPress Multisite subdirectories not allowed on new install?
- Creating a better multi-site search experience
- BackPress – which libraries i need to load to work with Multisite?
- How do I maintain static directories on multisite subdomains?
- Login on Multiple Sub-Domains without Multisite
- Prevent images on self-hosted WordPress from being served from WordPress.com
- WordPress with Lan and Wan Access?
- Moving WordPress Multisite
- WordPress multisite fails to create a new site in the network
- Changing path for media upload folder in wordpress multisite
- WordPress Multisite Wildcard Subdomains on Plesk
- Single install or multisite?
- WordPress Folder Multisite – dev, staging, www versions
- Setup a multisite to a running website
- Viewing / Editing A Multisite website after domain has expired
- Update post meta using save_post hook in multisite
- Nginx — WordPress multisite with root folder in own directory
- turning off multi site mode makes XMLRPC fail : you are not allowed to publish posts on this site”
- How to set up wordpress domain mapping on MAMP Pro
- How to show different sub sites based on Member’s user name In word press?
- Debugging unserialize errors [closed]
- new site admin not able to browse categories in wordpress multisite
- Multisite / Network – Stable?
- Eliminate MultiSite Network Splogs
- How To Disable Add new users On Subsites In Multisite?
- MultiSite: new Sites not showing up
- What is the best method of installing WP on multiple add-on domains?
- WP MultiSite: Can’t select database error after changing to new domain
- Different site different div content – Multisite
- Installing wordpress on a subfolder of adsense approved domain
- can’t create user without email for an author after converting single site to multisite
- Launch Media Library for specific MU site
- multiple domains point to same site on WP-MU
- Can I replace the “Upgrade Network” with SQL query?
- How to convert multisite subdomain from http to https
- One membership area for two websites
- Multisite install in a subfolder won’t work with www
- Domain mapping breaks some plugin scripts and css
- How to force WP to create a users table in multisite configuration?
- Whats a good strategy for localising WordPress post and page content?
- Updating themes customized by users
- WordPress and multisites, the rigth choice?
- Multisite pagination with get_posts
- Best Way to Setup a Network of WP Sites?