wp_validate_site_data хук-событиеWP 5.1.0

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.

Использование

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(массив)
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.

Список изменений

С версии 5.1.0 Введена.

Где вызывается хук

wp_prepare_site_data()
wp_validate_site_data
wp-includes/ms-site.php 480
do_action( 'wp_validate_site_data', $errors, $data, $old_site );

Где используется хук в WordPress

wp-includes/ms-default-filters.php 44
add_action( 'wp_validate_site_data', 'wp_validate_site_data', 10, 3 );