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.)

  • What is the add a listing button and how is it implemented in code? – Tom J Nowell Jul 30 '19 at 23:08

You 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');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.