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?