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