Some WordPress security plugins can help you to restrict access by IP addresses. These plugins allow you to create a whitelist of IP addresses that can access your site. You can also create a blacklist of IP addresses that are not allowed to access your site. This makes it easy to restrict access to your site by IP address. You can also edit the .htaccess file to restrict access by IP or logged-in users. To do this, you will need to access your website's files using FTP or a file manager.