Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
if you looking to restrict WordPress dashboard access by user capability to prevent registered users without admin capability to access WordPress admin so if you need to it in just one minute by this code snippet where let you filter by WordPress built-in hooks admin_init
Steps to restrict admin access to WordPress dashboard:
function zytheme_restrict_admin() { if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { wp_redirect( home_url() );// you can change it if you need to redirect to another page like register. exit; } } add_action( 'admin_init', 'zytheme_restrict_admin', 1 );
Did you find the WordPress snippets in this article helpful? Share it with your friends and if you have any questions and want to ask us about it, please don’t hesitate to add comments.