Initially I intended to fetch user ID so I could show/hide certain menu groups in my plugin based on user status (which I added as a meta).
The problem is that I can't use wp_get_current_user
and get_current_user_id
returns 0.
Is there any other way to get this ID? Or is there another way to hide/show menu based on logged in user status?
The structure almost looks like this.
add_action("admin_menu","show_menu");
function show_menu(){
//create menu1;
//create menu2;
if () //check user status
//create menu3
}
plugins_loaded
action it returns 0.