Title: Fix code login/logout redirect
Last modified: August 19, 2016

---

# Fix code login/logout redirect

 *  [ddlg2007](https://wordpress.org/support/users/ddlg2007/)
 * (@ddlg2007)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/fix-code-loginlogout-redirect/)
 * I put a code on my wordpress to login/register but i want he redirect to the 
   same page after login or logout:
 *     ```
       <!-- top-login --><div id="header-login"><?php
       global $user_ID;
       if(!$user_ID ) :?>
       Welcome, Guest
       <?php else :?>
       Welcome Back, <?php
       global $current_user;
       if ( isset($current_user) ) {
           echo $current_user->user_login;
       }
       ?>
       <?php endif;?>&nbsp;:&nbsp;<?php if (!(current_user_can('level_0'))){ ?>
   
       		<?php wp_register('',' | '); ?><?php wp_loginout(); ?>
   
       <?php } else { ?>
   
       		<a href="<?php echo get_option('home'); ?>/wp-admin/"><?php global $user_login;
   
       		get_currentuserinfo();
   
       		echo $user_login;
   
       		?></a> / <?php wp_loginout(); ?>
   
       <?php }?></div><!-- /top-login -->
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [ddlg2007](https://wordpress.org/support/users/ddlg2007/)
 * (@ddlg2007)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/fix-code-loginlogout-redirect/#post-2061221)
 * Thanksssssssssss like always all help me…

Viewing 1 replies (of 1 total)

The topic ‘Fix code login/logout redirect’ is closed to new replies.

## Tags

 * [redirect login](https://wordpress.org/support/topic-tag/redirect-login/)

 * 1 reply
 * 1 participant
 * Last reply from: [ddlg2007](https://wordpress.org/support/users/ddlg2007/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/fix-code-loginlogout-redirect/#post-2061221)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
