wp_logout_url($uri) having two redirect values
wp_logout_url($uri) having two redirect values
wp_logout_url($uri) having two redirect values
It could be a number of things. Do you check if the user is logged in on the relevant pages? For example: is_user_logged_in() || auth_redirect();
You might have to trigger wp_logout() yourself in that case: if ( $pagenow == “wp-login.php” && $_SERVER[‘REQUEST_METHOD’] == ‘GET’ ) { if ( (isset($_GET[‘action’])) && ($_GET[‘action’] == ‘logout’) ) { wp_logout(); } wp_redirect($new_login_page_url); exit; } That said, it sounds like a real pain to reinvent wp-login.php and handle the different form actions etc… a plugin … Read more
Well, for those who are curious, and to the best of my knowledge/investigation: it turns out this was a strange bug/issue of Chrome Portable* version 47* I was using on my older laptop. It does not happen in other browsers and regular Chrome installation. (with Windows XP, because of EOL support)
wp_logout() not working after form submission
You can work with is_user_logged_in() function to create a if / else statement in your menu. Here a quick code. <?php if ( is_user_logged_in() ) { ?> <li class=”menu-item”><a href=”https://website.com/my-account/orders/”><i class=”fa fa-handshake-o”></i>My Orders</a></li> <li class=”menu-item”><a href=”https://website.com/my-account/customer-logout/”><i class=”avatar”></i>Log out</a></li> <?php } else { ?> <li class=”menu-item”><a class=”porto-link-login” href=”https://website.com/my-account/”><i class=”fa fa-user”></i>Log In</a></li> <?php } ?> You could … Read more
You have the PHP IF statement needed, is_user_logged_in(). Just add your button to that and you should be good. Something this… <?php if (is_user_logged_in()) { echo ‘<button type=”button” class=”show-btn”>LOG IN</button>’; } else { echo ‘<button type=”button” class=”show-btn”>REGISTER</button>’; }; ?> Note: You have an extra </div> in your code above.
yes we make custom page as logout link on this way add this in function.php add_action( ‘init’, ‘log_out_user’ );function log_out_user() { global $wp; $url=”http://”.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’]; //get current page url if(!empty(get_current_user_id()) && $url == ‘example.com/logout’ ) //check if user is logged in and current page url { wp_logout(); //this will logout user $siteUrl = site_url(); //get site … Read more
You should use one of the actions that occur after parse_query, because then the variables on which the conditional tags are based are set. Such action can be template_redirect. The conditional tag will allow you to check if the current page is a store page. To log out the user, use the wp_logout() function. add_action(‘template_redirect’, … Read more
Output the logout link with wc_logout_url() and it will be nonced and have no confirmation. The confirmation is a security measure. You could also try adding the following to your functions.php or a plugin: // Logout without confirmation. function wpse_bypass_logout_confirmation() { global $wp; if ( isset( $wp->query_vars[‘customer-logout’] ) ) { wp_redirect( str_replace( ‘&’, ‘&’, wp_logout_url( … Read more