I started a session and assigned a value and based on the value other function executes but the page reloads after first session and obviously session resets and the other page where I am calling this session the required value is not fetched.

So is there a way to stop session reset? Please help thanks in advance.


WordPress doesn't use PHP sessions.

If you tried stating a session in your custom-written code, it's not going to work as you'd hope.

There's a plugin which will enable all normal session use: https://wordpress.org/plugins/wp-native-php-sessions/

But, depending on what exactly you're trying to achieve, you may prefer to keep things clean/do it the WordPress way and use a cookie and store data in the database as user_meta.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.