dptx8888 2018-07-05 17:42
浏览 86

Wordpress使用带缓存的模板中的php会话变量

I am using a php session variable to store and show some data between couple of wordpress page templates. It is working perfectly in my development server but the session variable is not getting set in the live wpengine hosting. I think they have some wordpress caching plugin enabled.

I am using the following code in the functions.php to enable session. Anyone have any idea to workaround this issue ?

function register_session() {
        if ( ! session_id() ) {
            session_start();
        }
    }
add_action( 'init', 'register_session' );
  • 写回答

1条回答 默认 最新

  • dongyanling9248 2018-07-05 19:03
    关注

    There is a plugin called WordPress Native PHP Sessions

    WordPress core does not use PHP sessions, but with this plugin, you can have this feature.

    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题