简体   繁体   English

在wordpress中调用wp_current_user()会使非jquery

[英]calling wp_current_user() in wordpress makes non jquery

I am creating website in WP with s2member plugin.I used these few lines inside where I used the s2member member code 我正在使用s2member插件在WP中创建网站。我在使用s2member成员代码的地方使用了这几行

 $current_user = get_current_user_id(); / get current looged in user ID
    $_SESSION['id']=$current_user;  // put that in session

I have queries that is this the right way to set session in WP? 我有疑问这是在WP中设置会话的正确方法吗? (I used set_session on top) Results: (我在上面使用了set_session)结果:

  • The jquery doesn't run after if uncomment above code.. 如果取消注释上面的代码,则jquery不会运行。
  • The grey bar on top of WP that shows current logged in user becomes complete blank,it doesn't show any logged in user. WP顶部显示当前登录用户的灰色条变为完全空白,它不显示任何登录用户。

    评论代码吧

I thnk that there is different way to set session in WP or it doesn't allow you to do so.. Any help in this regard. 我认为在WP中设置会话有不同的方法,或者它不允许你这样做..在这方面有任何帮助。 Thanks 谢谢

Not sure of the context where this is being used, but two things: 不确定使用它的上下文,但有两件事:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM