/*ip address used here can only access wp-admin page all other ips will not be able to access it */ function block_all_user_except_allow() { $allow = array("xx.xxx.xxx.xx","xx.xxx.xx.xx"); if (!in_array ($_SERVER['REMOTE_ADDR'], $allow)) { header("Location: https://yourwebsite.com"); die(); } } add_action('login_init', 'block_all_user_except_allow');