In other words, you need a landing page for visitors.
Create a new page from within admin
Then admin settings “read” and the select the appropriate option
Select also the page you created
In addition, you can also create a template just for this page.
Anyway, by default, when arriving on a BP site, anybody is non logged in. Why do you want to redirect in this case ?
I don’t want a landing page for visitors, I want normal visitors to see all of the usual pages & posts on the public part of the site. This is happening fine. What I want is for them to arrive on a nice page if they search for something that is on a hidden private part of the site. I am using Private Buddypress to hide members area (private profiles, forums etc) from the main marketing pages of the site ( WP pages and posts). The Private Buddypress plugin annoyingly redirects to the standard WP login screen (as you can see in the code from that plugin posted in my original Q). I do not like this, because it gives no explanantion to the user why they searched for something and arrived at a login screen. This is why I want to redirect to my custom 404 page, which I have modified to say that the item they are looking for is not found, or it is only visible to logged in members. What I want to know is how EXACTLY to modify the above code to get the redirect to point to the 404 page.
The login screen is not helpful, and in fact it’s offputting/confusing because you have to be a member of our photo club to be allowed into the community – so we don’t accept public registrations. Showing a login screen makes it seem like people should be able to register somehow, when they can’t.
I should say that I have already tried simply replacing wp-login.php for something else – even going so far as to make a special page to sit in the same root as wp-login.php but each time I resulted in an infinite loop which meant you couldn’t see ANY of the site without logging in.
In case anyone else has the same issue, I switched to BuddyPress Private Community pluign and that seems to sort everything out fine.