Is there a way to detect if a blog was deleted, deactivated or archived within a Multisite installation ?

Something that will be the opposite of wpmu_new_blog

I've search google, wasn't much help.

Searched here found: WPMU Hook for archive or deactivate blog?

This post looks relevant however they did not cover deletion nor was it confirmed working by the 'op'.


1 Answer 1


If you look at the top answer of the question you found you can read that the user found the hook wpmu_deactivate_blog on wpseek.com.

Searching for delete_blog got me here: delete_blog. I think delete_blog is the hook you're looking for. Try it and maybe you can confirm it yourself.

From the WP3.0 source:

delete_blog is an Action hook that's fired in the wpmu_delete_blog function.

function wpmu_delete_blog( $blog_id, $drop = false ) {
    global $wpdb;

    $switch = false;
    if ( get_current_blog_id() != $blog_id ) {
        $switch = true;
        switch_to_blog( $blog_id );

    $blog = get_blog_details( $blog_id );
     * Fires before a blog is deleted.
     * @since MU
     * @param int  $blog_id The blog ID.
     * @param bool $drop    True if blog's table should be dropped. Default is false.
    do_action( 'delete_blog', $blog_id, $drop );

By the looks of it, the function switches to the right blog before firing the delete_blog action hook.

  • Alright seems all 3 works delete_blog, archive_blog, deactivate_blog Thanks
    – Neta Meta
    Jan 20, 2014 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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