Any caching solution will probably break sessions.
Try turning off all caching (as well as CloudFlare proxy for your IP address) and see if your code works. If you have a WordPress caching plugin – turn that off too. If your hosting provider does some caching – turn that off too.
After turning off all caching if your site works, then you’ll have to either 1) find another solution not using PHP sessions (recommended), or 2) make sure you never cache your pages (not recommended).
Related Posts:
- PHP 7.2 – Warning: count(): Parameter must be an array or an object that implements Countable
- Sticky and NON-Sticky sessions
- Session timeout in ASP.NET
- Authentication: JWT usage vs session
- How to use my own custom session value in WordPress?
- achieving login implementation without using sessions
- Destroy user sessions based on user ID
- Enable WordPress Sessions
- Where is the wordpress session stored?
- Share session between my site and WP blog [closed]
- How to get outside login data (session) in WordPress?
- Session problem in PHP – trying to create a simple CAPTCHA
- Multi-instance WordPress usingn Memcached to handle sessions requests login every time a requests is handled by a different server
- Would this be achieveable?
- Using session in WP without trouble with the API REST
- Re-use Nonce in Repeating Event Signup Buttons
- Plugin is attempting to start a session with WordPress. WP Session Manager will not work! DomPdf
- Retrieve parameter from url
- Session constantly resets variable
- sharing the same cookie session with multiple wordpress installs on the same domain?
- How to check if the user was redirected?
- Session stays active until page update in dashboard
- Parsing session info between WordPress and non-WordPress
- $_SESSION dosent’t work
- S_SESSION variable (user role) not recognised
- How to use cURL to send Cookies?
- “Cannot send session cache limiter – headers already sent”
- How to declare session variable in C#?
- How to fix the session_register() deprecated issue?
- Undefined variable: $_SESSION
- Session variables not working php
- How to store and receive variables in WP sessions?
- Removing username from the ‘wordpress_logged_in’ cookie
- Are transients private or public?
- Is it possible to transfer a WordPress session to a different browser via query string?
- Allow up to 5 Concurrent Login Sessions
- Does using set_transient() function can lead to MySQL problems?
- Clearing cookie on logout and session expiration
- share login/logout sessions across two installs?
- How can I get logged in user’s session data from admin-ajax?
- How can I test the login for an expired session?
- How do I extend auto logout on idle OR redirect inline popup
- $_SESSION variables lost during OAuth callback
- 2 different post->IDs for single page load only in Firefox
- how to logout user on browser tab or window closes
- Custom query form submission pagination
- Site Health : An active PHP session was detected
- Random popup image per user with no repeat
- How does WordPress handle sessions?
- How to get session token of current user in wp_login hook?
- WooCommerce: Change default country on the cart page [closed]
- Trigger a function immeditely after a user posted a comment
- Disconnect automattically after X minutes
- WordPress as webapp login session
- How to implement a $_SESSION alternative in WordPress inside a theme without a plugin?
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
- Session Experies and Get Logged Out Within Few Minutes
- How to store post ID’s in cookie or session to display the same posts later
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Session destroyed on page redirect
- Login/Logout Session Sharing – Multiple WordPress Installations
- Disallow second login session
- Permalink structure with $_SESSION variables
- Unique session WordPress
- Unset session variable on page reload / setup but exclude AJAX
- Turning on output buffering in a wordpress plugin
- Run query_posts if SESSION is empty?
- keep a variable for all pages in memory from the url
- $_SESSION variable not saving on page refresh or new page
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- Custom $_SESSION expires too early
- Get current session in WP admin
- Store and Change Session variable – PHP SESSION VARIABLE
- PHP session when called wp_ajax_nopriv
- One time login on 2 different WordPress sites
- Error when setting cookie
- Replacing a placeholder term with a session variable value in taxonomy filter
- Codeless random token generation to pass into multiple tracking links in a single page load
- add class to element if user is not logged in [closed]
- Strange admin-ajax / CSS / $_SESSION issue
- Plugin or ways to limit number of users logging in the website,
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Correct user session/cookie handling with external site connection in wordpress
- Requiring a Visitor to Enter a Password Each Time They visit a Page
- after logout session not destroy from server/website side
- Sessions with WordPress
- Best hook for when a user session ends?
- Why isn’t working WooCommerce session inside shortcode?
- Pass WordPress variable to the next page
- Use WP user status (logged_in) to manage access to independent application
- ajax polling with admin-ajax.php
- how to remember specific action/event for current user?
- How to destroy all user sessions via WP-CLI
- User not logged first time I open the homepage
- Where are Sessions are being started? [closed]
- WordPress & PHP sessions
- How to limit user to login only once per session
- determine active user browser at the same time
- How to dynamically change the locale?
- Recognize logged WP user in existing REST API