wp_validate_site_deletion
Action HookDescription
Fires before a site should be deleted from the database. Plugins should amend the `$errors` object via its `WP_Error::add()` method. If any errors are present, the site will not be deleted.Hook Information
File Location |
wp-includes/ms-site.php
View on GitHub
|
Hook Type | Action |
Line Number | 237 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Error
|
$errors
|
Error object to add validation errors to. |
WP_Site
|
$old_site
|
The site object to be deleted. |
Usage Examples
Basic Usage
<?php
// Hook into wp_validate_site_deletion
add_action('wp_validate_site_deletion', 'my_custom_function', 10, 2);
function my_custom_function($errors, $old_site) {
// Your custom code here
}
Source Code Context
wp-includes/ms-site.php:237
- How this hook is used in WordPress core
<?php
232 * @since 5.1.0
233 *
234 * @param WP_Error $errors Error object to add validation errors to.
235 * @param WP_Site $old_site The site object to be deleted.
236 */
237 do_action( 'wp_validate_site_deletion', $errors, $old_site );
238
239 if ( ! empty( $errors->errors ) ) {
240 return $errors;
241 }
242
PHP Documentation
<?php
/**
* Fires before a site should be deleted from the database.
*
* Plugins should amend the `$errors` object via its `WP_Error::add()` method. If any errors
* are present, the site will not be deleted.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object to add validation errors to.
* @param WP_Site $old_site The site object to be deleted.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/ms-site.php
Related Hooks
Related hooks will be displayed here in future updates.