Created
February 3, 2015 15:15
-
-
Save kingkool68/16abf2b3dcc4f39b2201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Plugin Name: Only Certain Logins Allowed | |
* Description: Only let certain usernames do anything... | |
* Version: 1.0 | |
* Author: Russell Heimlich | |
* Author URI: https://twitter.com/kingkool68 | |
*/ | |
function only_certain_logins_allowed() { | |
$allowed_usernames = array( 'trotton', 'rheimlich' ); | |
$user = wp_get_current_user(); | |
if( !in_array( $user->user_login, $allowed_usernames) ) { | |
wp_die( 'Maintence Mode: you\'re not allowed. Ask Tracy ¯\_(ツ)_/¯' ); | |
} | |
} | |
add_action( 'init', 'only_certain_logins_allowed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment