Select Page

The first thing I would do is have a look to see if there is already a plugin that does just that. So I go to https://wordpress.org/plugins/ and check for a reliable plugin (meaning good reviews, preferably a plugin that has been updated recently, is compatible with the WordPress version they are using).
In this case it seems “Force Login” can do the trick. I communicate this to the customer and asks them if it fulfills their needs (also their unspoken needs).
When there is no existing plugin that fulfills 100% the needs of the customer, I would do the following (especially if they already have a Child Theme).
Add a piece of code into the functions.php of the childtheme.
This would be the pseudo code:
If (current_user_not_logged in && current_url_not_home_page)
then
{
 redirect_to_homepage();

}

If there is no Childtheme, I would or create a Child Theme or depending on their needs*, I would turn the code above into a plugin.
* Having it in a plugin has the advantage an admin user can easily turn the functionality on/off.