This happens because you are missing the neccessary nonce in the URL, which is being checked in wp-login.php
case 'logout' :
check_admin_referer('log-out');
...
Use wp_logout_url
in order to retreive the URL including the nonce. If you want to redirect to a custom URL, simply pass it as an argument.
<a href="https://wordpress.stackexchange.com/questions/67336/<?php echo wp_logout_url("/redirect/url/goes/here') ?>">Log out</a>
You could also use wp_loginout
which generates the link for you including translation:
echo wp_loginout('/redirect/url/goes/here')
Related Posts:
- How change wordpress password without logout ( need for plugin )
- Logout URL performing strange
- Clearing cookie on logout and session expiration
- wp_logout Not Logging Me Out
- Get wp_logout_url function to work on external (non-WordPress) page
- WordPress failure when logging out
- wp_logout() changes in WordPress 5.1.1
- wp_logout not redirecting using wp_logout_url() and wp_redirect()
- Logout using link (without nonce)
- Logout redirects to /forums/
- What is difference between logout and switch off?
- LogOut button only if logged in in front end menu widget
- wp_logout_url($redirect) won’t logout and redirect ()
- How to hide “You are now logged out” message on WordPress login form?
- logout error “something went wrong”
- Logout all users at particular time
- What is the link to log out on WordPress?
- How do I replace “Log Out” from the Menu with “My Orders”?
- Redirection of wp-login.php results in non working of Logout process
- wp_logout_url($uri) having two redirect values
- wp_logout problem
- How to restrict browser back button after logout?
- How reduce wordpress login session timeout time?
- Logout redirect to home page
- How to change the default logout link on WordPress Admin
- Logout redirect to current page – function
- Masking logout URL
- handling login/logout redirects
- share login/logout sessions across two installs?
- Change “You are now logged out” text
- Logout via Subdomain, non-wordpress page on a different server?
- WordPress Nonce Issue for Ajax Login and Logout
- wp_logout action not working
- add the user name to menu when user is logged in [closed]
- Ajax function returns -1
- wp_logout_url() redirects to confirmation page even with nonce?
- Getting User email on logout. wp_logout
- wp_logout_url isn’t forwarding to correct link
- wp_nav_menu log in/out link?
- How do you log a user out with wp_logout?
- How long do users stay logged in if they DON’T check remember me?
- Redirect user after logout
- I keep getting logged out in Firefox
- Logout redirects to a broken page(home URL is omitted)
- how to logout user on browser tab or window closes
- Custom Connect to Facebook, problem logging in/logging out
- Logout user and delete cookies from the client side?
- Deleting cookie to logout
- Preexisting login to change to logout link in sub menu
- WordPress custom login page
- wp_logout_url redirects to incorrect page because of pagination
- Hook to change Logout url
- Disconnect automattically after X minutes
- How to: PHP Log Out Link?
- do_action appearing outside of menu?
- Login/logout in header
- Logout users upon login, based on caps/role?
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
- Session Experies and Get Logged Out Within Few Minutes
- Update user meta on logout
- After logout browser’s back button into twenty sixteen theme profile
- Disallow second login session
- WordPress error on log out ‘Not Permitted’ and can’t log out
- Use wp_logout_url() in menu creation page
- Add logout link when logged in, make it disappear when logged out?
- Woocommerce, prevent login after registration and redirect to custom URL
- Logout without confirmation and SAME window on mobile
- Force Users To Relogin
- wp_logout hook never triggered
- Logout after clicking URL link results in “headers already sent” error
- Woocommerce – auto logout after payment
- Logout redirects to default page
- How to Show Different Menus to Logged in Users in WordPress [duplicate]
- get_permalink not fetching correct pages
- wp_logout_url($redirect); is not working in wordpress
- WordPress Login/Logout Single Menu Only
- Add Login and logout buttons to top menu bar
- add class to element if user is not logged in [closed]
- Multiple use wp_logout_url() on page cause ‘header already sent’ error after submit form
- Check if user had autologin & if so, logout
- Change auth_cookie_expiration for specific roles and specific login times
- Log out without confirmation request (nonce)
- How to logout the current user without notices and warnings?
- Change button link to add nonce
- Problem with is_user_logged_in() function in some pages
- How to add Loginout to Sub-menu
- Change Login or Logout text based on status
- wp_logout() not working after form submission
- Why deleting/removing cookies in WordPress does not log me out from admin?
- how to refresh page after user logout with ‘wp_logout_url’?
- Custom, conditional redirect on logout
- Logout link not working
- after logout, get_current_user_id still holds value
- To Add Logout Button in Menu [duplicate]
- Need edit profile link in the menu for logged in users
- WordPress Logout Redirect Follow up
- Inconsistent login state
- Can i hide a dynamically created div to logged out users?
- Logout button in menu without “wp” in links
- Logout redirect via page template without confirmation?