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
- Form submission: PHP S_SESSION statements within a foreach loop
- How do I expire a PHP session after 30 minutes?
- PHP Unset Session Variable
- proper way to logout from a session in PHP
- How to access Session variables and set them in javascript?
- How to set session timeout in web.config
- How to share cookies and sessions between domain and subdomain?
- Extend WordPress (4.x) session and nonce
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- How to pass users back and forth using session data?
- How should you hook a session_start() when authoring a plugin?
- Display message once per session to users with a specific role
- Why does $_SESSION only work when I am logged in?
- Handling nonces for actions from guests to logged-in users
- Sessions not creating correctly in custom function
- Session is not starting
- how to show posts of category random by session
- Should I store my Facebook access tokens?
- How to get login data (session) outside WordPress?
- update_user_meta() does not work
- How to expire session after 2 hours and also expire when browser closed?
- pass-protected pages and posts not protected after enter them 1 time
- Pagination with $_POST and $_SESSION
- Why is the session clearing after wp_safe_redirect?
- User Session and Stored Cookies not get removed
- Check if user is logged in to site A when visiting site B
- Expired session error (admin) when I try to make a call to WooCommerce api [closed]
- Share WordPress login info with other PHP app
- Change the default 10-day expiration for the password protected pages cookie
- How Can I Move Data From Form 1 To Form 2
- How to store or cache custom shopping cart data for every user’s session
- How to store and receive variables in WP sessions?
- PHP header() gives headers already sent
- Safe to start a php session on get_header action?
- Get my site session in wordpress?
- Unset session variable on page reload / setup but exclude AJAX
- Front end ajax user login session issue
- Displaying “One Time” Notification in Plugins
- Run query_posts if SESSION is empty?
- How to change WordPress cookies to be session-only
- How do I add $_SESSION[”] to my wordpress page?
- Updating transient value frequently
- how do i change my website facebook login button to another text immediately user login? [closed]
- Custom $_SESSION expires too early
- Store and Change Session variable – PHP SESSION VARIABLE
- PHP session when called wp_ajax_nopriv
- WordPress Website with Login system
- Error when setting cookie
- Add session or cookie to remember last menu location
- Replacing a placeholder term with a session variable value in taxonomy filter
- Set cookie parameters on wp site – PHP not working?
- logout users with specific role after close browser tab
- Session management issues with WordPRess 404 Error page
- Unable to execute Ajax request, status code 400
- Plugin or ways to limit number of users logging in the website,
- Restricting wordpress login sessions for a web app
- Like and Dislike Buttons on Post with Counter – Only allow one click per post per user session
- End session screen not close automatically after login
- PHP session not staying alive. headers already sent
- Login issue with subdomain installs
- Best hook for when a user session ends?
- Pass WordPress variable to the next page
- ajax polling with admin-ajax.php
- PHP Session Variable to WordPress Error
- Allow user to select location and then set cookie for location in WordPress
- Capture and display users name
- How to create session for user which is not an admin user
- Session variables lost during Ajax calls – WordPress – Sage Starter Theme
- Why WordPress not logout after I have close my browser?
- How to ‘remember’ a site member’s last visited page?
- Can’t redirect to previous page after using GET
- SHORTINIT and sessions
- how to manage Session in WordPress using custom login?
- Suddenly sessions and header location not working
- WordPress keep logged in after browser close
- How to invalidate wordpress_logged_in cookie via backchannel logout