WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

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

share|improve this answer
Thanks!Its very helpful – Adam Mar 9 '13 at 15:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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