Created
July 5, 2012 09:17
-
-
Save emzo/3052518 to your computer and use it in GitHub Desktop.
WP Protect user account from deletion
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
add_action( 'delete_user', 'dont_delete_user' ); | |
function dont_delete_user( $id ) { | |
$dont_delete_ids = array( 1, 2, 3, 4 ); // protected user IDs | |
if ( in_array( $id, $dont_delete_ids ) ) | |
wp_die( 'You cannot delete this user account.' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment