Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action when a WPMU blog is deleted? Something which looks like this:

add_action('blog_deletion_hook', 'function_to_perform')

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Yes, inside /wp-admin/includes/ms.php there is the action hook delete_blog.

This test prevents a blog deletion:

add_action( 'delete_blog', 'prevent_blog_delete_wpse_82961', 10, 2 );

/**
* @param int $blog_id Blog ID
* @param bool $drop True if blog's table should be dropped. Default is false.
*/
function prevent_blog_delete_wpse_82961( $blog_id, $drop ) 
{
    wp_die( 'aborting delete_blog' );
}
share|improve this answer
    
This did the trick, thanks! Although I ran into the problem that the action I wanted to perform on deletion didn't work with WPMU. I solved this by 'Network Enabling' the plugin. :) –  Steef Jan 25 '13 at 0:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.