Frontier Restrict Backend
Frontier Restrict Backend will restrict users from access to the backend (admin area)
Main Features
- Users without the capability manage_options will not have access to the backend (admin area, and will be redirected to the home url.
Frontier Restrict Backend on wordpress.org: Download Plugin | Plugin Support
Code is simple, and if you do not want to install the plugin, you can add the below code to your functions.php
function my_own_restrict_backend($query)
{
if ( is_admin() && ! current_user_can( 'manage_options' ) )
{
$admin_ok = false;
if (defined( 'DOING_AJAX' ) && DOING_AJAX )
{
$admin_ok = true;
}
else
{
if (strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/media-upload.php' ) !== false)
{
$admin_ok = true;
}
}
if ( !$admin_ok)
{
error_log("Back-end access blocked");
wp_redirect( home_url() );
exit;
}
else
{
error_log("Back-end access allowed - Media upload or AJAX");
}
}
}
add_action( 'init', 'my_own_restrict_backend' );
Comments
Frontier Restrict Backend — No Comments
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>