Restrict Dashboard to Administrators Only
<?php
add_action( 'init', 'cxc_restrict_admin_access_call_back' );
function cxc_restrict_admin_access_call_back() {
if ( is_admin() && ! current_user_can( 'administrator' ) && ! wp_doing_ajax() ) {
wp_redirect( home_url() );
exit;
}
}
?>
Was this article helpful?
YesNo