Get the current logged-in user data in WordPress
Get the current user in WordPress: wp_get_current_user() and friends Showing the name of the logged-in user, loading their own data, hiding a block from guests: almost every project needs the current user. WordPress has a small set of functions for it, and the only real pitfall is calling them too early, before WordPress knows who…