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条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料