Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Why is my cookie not unsetting upon logout? [closed]

looks like I needed add a path to my cookie. This fixed it:

$timer = time()+86400;
setcookie('alertuser', '1', $timer, "https://wordpress.stackexchange.com/");

and

$timer = time()-86400;
setcookie('alertuser', '', $timer, "https://wordpress.stackexchange.com/");

Related Posts:

  1. How to resolve error “Cookies are blocked due to unexpected output.”?
  2. Using a nonce in a Custom Login Form
  3. I can’t log into my website , it says “Error: Cookies are blocked due to unexpected output”
  4. What is PHPSESSID?
  5. User registration followed by automatic login
  6. Setting custom cookies in WordPress
  7. Adding “Remember Me” in custom login
  8. How to change the wp-login.php page title?
  9. How to set custom cookies before output
  10. How build a custom login/register form with error handling?
  11. Check if user already visited this post today
  12. Display message once per session to users with a specific role
  13. Change the footer text on the login page
  14. Changing user_nicename
  15. Using Cookie Data For WP_Query Loop
  16. WordPress 4 invalid username special charachters issue
  17. How to place login logout link on menu that redirects users back to current page?
  18. How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
  19. Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
  20. Constructing a custom login form using ajax
  21. automated tests as a user?
  22. Remove username in emails or swap username for email
  23. woocommerce and is_user_logged_in() if not redirect to homepage
  24. Check if user is logged in when clicking certain links on certain pages
  25. PHP If user is logged in & on home page redirect
  26. WordPress shows registration link for non logged users
  27. Creating login session via CURL
  28. Admin username and password
  29. How to sanitize my cookie name
  30. Recovering WP Login Credintials in Code?
  31. Is it necessary to sanitize wp_set_password user input?
  32. Setting a cookie upon specific URL visit
  33. WordPress custom login form using Ajax
  34. How to give new users two specific user role options upon WordPress user registration
  35. How to Highlight unread WordPress posts?
  36. Wp-login appears White Screen, Error: Cannot modify header information
  37. How to: PHP Log Out Link?
  38. Login/logout in header
  39. User management system similar to wordpress one?
  40. How to combine wordpress_logged_in cookies in one cookie?
  41. Programmatic Login from 3rd Party site
  42. Cannot access wp-admin/wp-login.php (WordPress backend) anymore, what could be wrong?
  43. How to debug my custom login form looping intermittently
  44. How to store post ID’s in cookie or session to display the same posts later
  45. how can i use $_COOKIE[] + PostID to execute the below code?
  46. getting logged in user info (wp-load.php) from parent directory
  47. iframe does not store session/cookie when refresh parent
  48. Problem with login form
  49. Login to wordpress by clicking a link and specifying usernaname and password in url
  50. Insert custom PHP head above in WP pages
  51. Log in / Log Out Custom Button
  52. Should `wp_login` be used since it’s deprecated?
  53. How to redirect users based on role and content of redirect_to?
  54. Change CSS based on is_user_logged_in
  55. How to display login form anywhere, when user isn’t logged in, without redirecting?
  56. How can I open up my administrative panel to everyone?
  57. My php code is not being executed
  58. How can I add a new row in a separate database when someone registers via WordPress?
  59. $_SESSION variable not saving on page refresh or new page
  60. One account with multiple logins
  61. Lost in trying to create user database system
  62. Shortcode to log user into current URL
  63. How to set cookies
  64. PHP getting error when trying to access WP-Admin Dashboard
  65. I installed WordPress locally now how do I login?
  66. If user is logged in not working
  67. How to make a cookie be on the whole site instead of being on a specific page/
  68. Change homepage content if user is logged in – BuddyPress
  69. Set cookie for visitor
  70. Authentication from sub-folder non-wp cookie WordPress
  71. Show login greeting above sub-menu links?
  72. setcookies and header send
  73. is_user_logged_in returning nothing on custom page
  74. Help with accessing wp-admin page and resolving error messages
  75. Triggering a timewall after X days
  76. Set cookie parameters on wp site – PHP not working?
  77. Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
  78. Can’t log in to WordPress wp-admin after adding code to functions.php
  79. Check if user had autologin & if so, logout
  80. Fatal error login WordPress [duplicate]
  81. Admin Panel 404 Error after login
  82. PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
  83. How to block specific user id in custom login form?
  84. Log out without confirmation request (nonce)
  85. IF statement not working – Any suggestions?
  86. Having trouble creating two shortcodes, one for logged in user and one for visitors
  87. Call WP Rest-Api to GET /users/me returned NOTHING in console
  88. Restrict wordpress access to logged users only
  89. Infinite loop when logging out using custom login form
  90. Menu not updating for logged in users after redirect
  91. how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
  92. Issues adding Recaptcha v3 to WordPress Registration
  93. Display specific page if user signed in
  94. Change Login or Logout text based on status
  95. Refresh page after login with litespeed cache
  96. Redirect after login depending on the URL
  97. Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
  98. Redirecting the lost password page request when using a custon login page
  99. How do I send a POST request with params with WordPress REST API
  100. Use WP user status (logged_in) to manage access to independent application
Categories PHP Tags cookies, login, php
Selecting a post in Dashboard
Wrap the widget content with a div and get the widget title outside? [closed]

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress