WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/deactivate blog

Description

deactivate_blog is an action triggered whenever an existing blog is deactivated within a multisite network.

Usage

<?php add_action( 'deactivate_blog', 'function_name' ); ?>

where "function_name" is the name of the function to be called.

Within a class, use the following syntax;

<?php add_action( 'deactivate_blog', array( $this, 'function_name' ) ); ?>

Parameters

$id
(int) (optional) Blog ID of the blog being deactivated.
Default: None

Example

/**
 * Example of deactivate_blog usage
 * 
 * @param int    $id Blog ID of the blog being deactivated.
 */
function wporg_deactivate_blog_example( $id ) {
	if ( 5 == $id ) {
		// Update some option or something
	}
}
add_action( 'deactivate_blog', 'wporg_deactivate_blog_example' );

Source File

The deactivate_blog hook is found in wp-admin/network/sites.php.