Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.