Unable to get current user ID
-
Hello –
I’m pretty new to wordpress. I’m trying to get the current user ID in one of my plugin pages. I’ve tried wp_get_current_user()->ID, but that’s returning 0. From what I’ve read, I realize that this page is being loaded prior to the aforementioned wrapper, and that I probably need a hook to get it properly. I really have no clue what I’m doing with hooks, so if somebody could shed some light on this I’d appreciate it. Is wp_login the best hook to use?
Why is it that in some of my plugin pages I’m able to get the current user using wp_get_current_user() but some pages I can’t?
Thanks!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Unable to get current user ID’ is closed to new replies.