everyone: this question seems pretty commmon to ask, but I did not find any answer.

I was wondering, if there is a php function that I could use to direct a user to the site's registartion page, so that I can use php instead of link that I need to customize every time I change the link.

THank you

1 Answer 1


It's simple, use the function is_user_logged_in:

<?php if ( is_user_logged_in() ) { ?>

    <a hef="link-for-logged-users"></a>

  <?php } else { ?> 

    <a hef="link-for-users-not-logged-in"></a>

<?php } ?>

See here http://codex.wordpress.org/Function_Reference/is_user_logged_in


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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