Top Left Text cha

Web & App Development

Typical Shitpress coders... this code is all over the place - as a way to block access to the dashboard for all except administrators..

add_action( 'init', 'block_admin_access' );
function block_admin_access() {
if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Redirect to home page if a non admin user tries to access admin area
wp_redirect( home_url() );
exit;
}
}
What's wrong with this picture?  if is_admin???? It blocks the administrators you shitty coders!  Remove that part or make it !is_admin and it breaks the site.  This code is shit like most wordpress code.

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X