add_action( 'init', 'block_admin_access' );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.
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;
}
}
Dev & Tech Notes
San Diego | Los Angeles | Big Bear | USA
Terms & Conditions ©2005-2024 TJohns.co
Terms & Conditions ©2005-2024 TJohns.co
Top Left Text cha
Web & App Development
ShitPress Block Administration Advice
- Details
- Written by Timothy Johns
- Category: Problems & Bugs
- Hits: 1521
Typical Shitpress coders... this code is all over the place - as a way to block access to the dashboard for all except administrators..
Comments