Skip to content

Instantly share code, notes, and snippets.

@techskilled
Created September 8, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techskilled/4e01f8b915818ec3aaf72c70bd891b94 to your computer and use it in GitHub Desktop.
Save techskilled/4e01f8b915818ec3aaf72c70bd891b94 to your computer and use it in GitHub Desktop.
/** DISBALE WP-ADMIN FROM NON ADMIN : SOBER MEDIA 13/08/2016 **/
add_action('admin_init', 'no_mo_dashboard');
function no_mo_dashboard() {
$isAjax = (defined('DOING_AJAX') && true === DOING_AJAX) ? true : false;
//if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
if(!$isAjax) {
if(!current_user_can('administrator')) {
wp_redirect('http://www.example.com/'); exit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment