Home » Php » php – Can't read cookie value properly in WordPress Project (using WP Rocket cache plugin)

php – Can't read cookie value properly in WordPress Project (using WP Rocket cache plugin)

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am using WP Rocket cache plugin for my e-commerce project.

The thing is that $_COOKIE returns different value(cached value) from HTTP request header since I have enabled the WP Rocket plugin. I can see correct cookie is sent to server with HTTP header.

It works well when I disable the plugin.

I think it is a problem with cache but I can’t resolve this with programmatic way as it is WP Rocket plugin’s main function.

When I clear the cache using my admin panel, cookie is set once the first time and that value is returned afterwards.

Are there any option in WP Rocket plugin or can I solve this issue in another way?

Anyone please help me to use cookie properly as well as WP Rocket plugin enabled.

How to&Answers: