Title: login logout
Last modified: August 20, 2016

---

# login logout

 *  [leinster](https://wordpress.org/support/users/leinster/)
 * (@leinster)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/login-logout-2/)
 * Hi there,
 * I’ve added the login/logout/register links using the code below. I’m wondering
   is there more efficient code that does the same thing? I think it is effecting
   the loading of the site a bit.
 *     ```
       <div class="header-login">
       	<?php if(is_user_logged_in()): ?>
       	<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>
       	<?php endif; ?>
       	<?php if(!is_user_logged_in()): ?>
       	<a href="<?php echo wp_login_url(); ?>" title="Login">Login</a> | <a href="http://www.xxx.com/login/?action=register">Register</a>
       	<?php endif; ?></div>
       ```
   

Viewing 1 replies (of 1 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/login-logout-2/#post-3044348)
 * Try just using `<?php wp_loginout(); ?>`. It provides the functionality that 
   you’re replicating there.

Viewing 1 replies (of 1 total)

The topic ‘login logout’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/login-logout-2/#post-3044348)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
