Logout without confirmation and SAME window on mobile

Try using wp_redirect($url). See https://developer.wordpress.org/reference/functions/wp_redirect/ . So…something like: // set up the URL to redirect to $redirect_to = ‘https://www.example.com/page’; wp_redirect($redirect_to); exit; Note that exit is required to close out the code. See the docs in the above link.

Use wp_logout_url() in menu creation page

Add submenu with a custom link, /wp-login?action=logout, like the image below: Add code like below in functions.php: function wpa_remove_menu_item( $items, $menu, $args ) { if ( is_admin() || ! is_user_logged_in() ) return $items; foreach ( $items as $key => $item ) { if ( ‘Login / Register’ == $item->title ) unset( $items[$key] ); if ( … Read more

Disallow second login session

The reason you’re not finding anything is because WordPress does not use any form of “sessions”. Login status information is not saved, or retrieved. Logging into WordPress basically sets a cookie in your browser which is a single authentication point. It is the equivalent of a username and password, with encryption and a timeout, all … Read more

After logout browser’s back button into twenty sixteen theme profile

You should use the built in WordPress function is_user_logged_in(), as well as several other WordPress functions: if ( !is_user_logged_in() ) { wp_redirect( get_bloginfo( ‘url’ ) . ‘/index.php’ ); exit; } wp_redirect() handles the redirection for you. Please be aware that it does not exit automatically, so you should call it afterwards. I also built in … Read more

Update user meta on logout

For anyone who stumbles upon this, I have found a solution that works well for me. I wanted to be able to update user meta data during the logout process, whether it is user initiated or automatic through expiry of session data. So the solution: function logMeOutOrSomething($expiration, $user_id) { update_user_meta($user_id, ‘first_name’, ‘superMario’); return $expiration; } … Read more