I’m actually determined, searching for an answer for days now.
I would like to attain:
restricted entry for logged in customers solely
not logged in customers have to be redirected to a customized login web page
I’m on a multisite setup
the closest resolution but, is the next piece of code nevertheless it solely protects 1 web page, on this state of affairs it’s the house web page (e-mover.ch/distributor) as a result of the multisite is utilizing subfolders, so the primary url is e-mover.ch/distributor. So if somebody goes to this url, he’ll see the customized login web page (haendler-login) however he might ignore it and simply hit one of many menu objects and can get entry. I would like your entire web site restricted to logged in customers and I would like them to make use of the customized login web page, which is “haendler-login”.
I’ve tried some plugins however I at all times bought redirect loop errors when utilizing customized login plugins together with restricted entry plugins. This is the reason I’m searching for a “non-plugin” resolution.
Any assistance is welcome.
That is the closest I might get:
if ( !is_user_logged_in() ) {
$url_uri = $_SERVER['REQUEST_URI'];
//redirect store web page.
if ( $url_uri == '/distributor/' ) {
wp_redirect( home_url( '/haendler-login' ) );
}
}
Cheers
Mark