wp_insert_site
Action HookDescription
Fires once a site has been inserted into the database.Hook Information
File Location |
wp-includes/ms-site.php
View on GitHub
|
Hook Type | Action |
Line Number | 89 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Site
|
$new_site
|
New site object. |
Usage Examples
Basic Usage
<?php
// Hook into wp_insert_site
add_action('wp_insert_site', 'my_custom_function', 10, 1);
function my_custom_function($new_site) {
// Your custom code here
}
Source Code Context
wp-includes/ms-site.php:89
- How this hook is used in WordPress core
<?php
84 *
85 * @since 5.1.0
86 *
87 * @param WP_Site $new_site New site object.
88 */
89 do_action( 'wp_insert_site', $new_site );
90
91 // Extract the passed arguments that may be relevant for site initialization.
92 $args = array_diff_key( $data, $defaults );
93 if ( isset( $args['site_id'] ) ) {
94 unset( $args['site_id'] );
PHP Documentation
<?php
/**
* Fires once a site has been inserted into the database.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/ms-site.php
Related Hooks
Related hooks will be displayed here in future updates.