Redirection of wp-login.php results in non working of Logout process

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

How do I replace “Log Out” from the Menu with “My Orders”?

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

Logout user if click on a custom page link

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

Automatically Log Out UserX when visiting WooCommerceStore

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

logging out with/without confirmation – single site, multisite

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