There are many different plugins in WordPress Plugin Repository that allows you to limit your website access in different ways. Now this tutorial explains you limiting your WordPress site access for logged in or allowed by IP addresses.
Install and activate Restricted Site Access. After activation it adds various restriction options in admin area’s Reading & Privacy page. Visit your admin area Dashboard -> Settings -> Reading, scroll down and set the restrictions.
- Enable or disable site restriction
- Change the restriction behavior: send to login, redirect, display a message, display a page
- Add IP addresses and include ranges to an unrestricted list
- Quickly set your current IP address to the unrestricted IP list
- Customize redirect location, includes an option to send them to the same requested path and set the HTTP status code for SEO friendliness
- Define a simple message to show restricted visitors, or select a page to show them – great for “coming soon” teasers!