I am currently developing a multi-site plug-in for WordPress. I need to run a function when a new site is created.
Leave a Reply
You must be logged in to post a comment.
I am currently developing a multi-site plug-in for WordPress. I need to run a function when a new site is created.
You must be logged in to post a comment.
I guess you are looking for an action/filter.
wpmu_new_blog
this action is fired inwpmu_create_blog
function (wp-includes/ms-functions.php)Since WP 5.1.0,
wpmu_new_blog
has been deprecated in favour ofwp_insert_site
:Use it like this in your plugin or theme:
A good place to look for available hooks is
wp-includes/ms-default-filters.php
wp_insert_site on WordPress Developer Handbook