Anyone at all… It’s been three days, and I really need this
put this in your bp-custom.php and change the redirect page url properly.
`
add_action(“template_redirect”,”my_redirect”);
function my_redirect(){
if( !is_user_logged_in()&&is_front_page()){
wp_safe_redirect(get_bloginfo(‘wpurl’).”/about”);
exit(0);
}
}
`
That should work.
Thank you so much! Where do I put the URL I want to redirect to?
@Brajesh Singh it adds a visible strip of code to the top of the website, I don’t know whether that’s because I haven’t found where to put the url in or not?
@yoursocialbox
Seeing code at the top of a page is usually a result of improperly formatted opening/closing tags. Here are some things to check in your bp-custom.php:
– Make sure you’ve copied the code exactly as in the post above.
– Check the double-quotes; make sure they are straight quotes ( ” ) not curly ones.
– Be sure your bp-custom.php file content begins and ends with the proper tags: an opening “ tag at the very bottom.
The part of the code where you put your own URL is where you see `”/about”`. Change that to the page slug you want to redirect to (the page slug is what comes after your domain name). For example, if you want to redirect to http://example.com/my-redirect, change it to `”/my-redirect”`.
Hope this helps!
Watch out! I goofed in the post above: I forgot to enclose the quotes in backticks so they display properly.
Your double-quotes should look like this: `”`
NOT this: “
Thank you! I done all of that and it is now working perfect!