I have a business directory website. I'd like to know how to create a page display condition. Basically, when clicking on the "add a listing" button, how do I make non-logged-in users be directly taken to the login/sign up page instead of the "choose a listing type" page?
(Currently, all users are taken to the "choose a listing type" page, and if not logged in, after choosing the type are asked to sign-in/sign up and then taken BACK to the "choose a listing type" page. It's a lot of unnecessary back-and-forths.)
I have a business directory website. I'd like to know how to create a page display condition. Basically, when clicking on the "add a listing" button, how do I make non-logged-in users be directly taken to the login/sign up page instead of the "choose a listing type" page?
(Currently, all users are taken to the "choose a listing type" page, and if not logged in, after choosing the type are asked to sign-in/sign up and then taken BACK to the "choose a listing type" page. It's a lot of unnecessary back-and-forths.)
Share Improve this question edited Jul 30, 2019 at 22:42 Castiblanco 2,1947 gold badges20 silver badges26 bronze badges asked Jul 30, 2019 at 22:35 Myriam RichardMyriam Richard 1 1- What is the add a listing button and how is it implemented in code? – Tom J Nowell ♦ Commented Jul 30, 2019 at 23:08
1 Answer
Reset to default 0You can use this filter so when user comes into your website so you will redirect to them on specific page and display that specific page.
function user_redirect_page() {
return site_url().'your-page-slug';
}
add_filter('login_redirect', 'user_redirect_page');