wp_logout problem

You could create a custom Page template which contains only the logout code, no call to header.php etc. When you load the /member-logout/ page you’re probably calling the default page.php template which is loading header.php etc. If instead you apply your custom Page template it will just perform the logout action and can then redirect, … Read more

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

What is the link to log out on WordPress?

Yes, the code on your login.php?action=logout page can call wp_logout() to log out. You probably also want to hook the logout_url filter to generate your new logout URL, else menu bars and the admin site will still try to use wp_login.php.

Logout all users at particular time

You could use WP Cron to fire wp_logout() and make it more reliable by following instructions here https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/ Below is code for a plugin that would log everyone out, every day at midnight. Note if you wanted to schedule a one-time-only, single event, use wp_schedule_single_event instead of wp_schedule_event https://codex.wordpress.org/Function_Reference/wp_schedule_single_event // hook function myplugin_cron_hook() to the … Read more