How to display different links for logged in and logged out users?

Picture of Woocoders
Woocoders
2nd September 2020
<div class="fr">             
    <ul class="rss">                  
        <li><a href="http://example.com/go/wp-login.php">Support</a></li>                 
        <li><?php if (is_user_logged_in() ) { 
                echo " <a href=\"" . wp_logout_url() . "\" title=\"Logout\">Logout</a>";
            }else{ 
                echo " <a href=\"http://example.com/" title=\"Login\">Member Login</a>";
            } ?>
        </li>             
    </ul>         
</div> 

In case of redirecting you can use  wp_logout_url(home_url()) to redirect it to Homepage.

Share this post: