admin管理员组文章数量:1405196
I'm having a problem with my menu not being updated for logged in users. My website has a homepage which I want to change depending if you're logged in or not. I've done this by adding the following code to functions.php:
add_action('wp', 'add_login_check');
function add_login_check()
{
if ( is_user_logged_in() && is_page( [3585] ) ) {
wp_redirect('');
exit;
}
}
This solution might not be ideal, but out of all the ones I could find, this one is the only one that actually works for me.
I also use the plugins "User Menus" and "If Menu" to have separate menu items visible for logged in and out users. However, after being redirected by the code above, the menu does not update - I can still only see the menu items one should see when logged out, even though I am logged in. Going to any other page does show the menu as it should be, it's just that this page does not. Is there anyone who has an idea why this happens? Thanks in advance!
本文标签: phpMenu not updating for logged in users after redirect
版权声明:本文标题:php - Menu not updating for logged in users after redirect 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744873378a2629765.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论