Create a Login/Logout Link in WordPress
To create a login/logout link in WordPress you can use a snippet of php code using the wp_logout_url function, you can also set the logout URL to be an external site to your own. <?php if (is_user_logged_in()) : ?> <a href=”<?php echo wp_logout_url(get_permalink()); ?>”>Logout</a> <?php else : ?> <a href=”<?php echo wp_login_url(get_permalink()); ?>”>Login</a> <?php endif;?>
Read More