donglinyi4313 2016-11-10 13:40
浏览 52
已采纳

WordPress插件缓存问题

I'm trying to set and read cookies within WordPress across my site by way of a custom plugin that I wrote.

add_action( 'wp_head', 'my_cookie_code' );

The code that I wrote works, however, once it's deployed to our live server it does not.

I think this is because of our WordPress caching system. When I turn it off, my cookie code works but once it's on, it does not.

Without turning off my WordPress caching system, how can I get my code to work with it?

I want each page to be cached by the caching system but I still want my little bit of code to be executed.

Thanks

  • 写回答

3条回答 默认 最新

  • doulu6929 2016-11-17 17:04
    关注

    It appears that this is an issue with the WPEngine caching system.

    When I switched my code from being PHP based to JavaScript, I was able to solve the problem that I was having.

    More information on this issue can be found here: Cookies and php sessions on WPEngine

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?