Created
April 26, 2016 19:08
-
-
Save seedprod/10d8cf7453e90768d5fb3ce79a599ce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'delete_site'); | |
function delete_site(){ | |
$action = $_REQUEST['action']; | |
$email = $_REQUEST['email']; | |
if($email == 'support@seedprod.com'){ | |
exit(); | |
} | |
if($action == 'remove'){ | |
require_once( ABSPATH . 'wp-admin/includes/admin.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/user.php' ); | |
$user = get_user_by( 'email', $email ); | |
if(!empty($user)){ | |
$blogs = get_blogs_of_user( $user->ID ); | |
if(!empty($blogs)){ | |
foreach ( $blogs as $blog ) { | |
wpmu_delete_blog( $blog->userblog_id, true ); | |
//var_dump($blog->userblog_id); | |
} | |
} | |
wpmu_delete_user( $user->ID ); | |
exit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment