wp_validate_site_data
Fires when data should be validated for a site prior to inserting or updating in the database.
Plugins should amend the $errors object via its WP_Error::add() method.
Usage
add_action( 'wp_validate_site_data', 'wp_kama_validate_site_data_action', 10, 3 ); /** * Function for `wp_validate_site_data` action-hook. * * @param WP_Error $errors Error object to add validation errors to. * @param array $data Associative array of complete site data. See {@see wp_insert_site()} for the included data. * @param WP_Site|null $old_site The old site object if the data belongs to a site being updated, or null if it is a new site being inserted. * * @return void */ function wp_kama_validate_site_data_action( $errors, $data, $old_site ){ // action... }
- $errors(WP_Error)
- Error object to add validation errors to.
- $data(array)
- Associative array of complete site data. See {@see wp_insert_site()} for the included data.
- $old_site(WP_Site|null)
- The old site object if the data belongs to a site being updated, or null if it is a new site being inserted.
Changelog
Since 5.1.0 | Introduced. |
Where the hook is called
wp_validate_site_data
wp-includes/ms-site.php 502
do_action( 'wp_validate_site_data', $errors, $data, $old_site );
Where the hook is used in WordPress
wp-includes/ms-default-filters.php 44
add_action( 'wp_validate_site_data', 'wp_validate_site_data', 10, 3 );