1

I have been working on a WordPress plugin for a couple of days, and I got it to the point where it works - I was however unhappy with the procedural code (I was rushing it for my site, to come back to it later).

Anyway, I've now started moving everything into classes and appropriate functions - and I've hit a snag. I need to access user data of the currently logged in user, however - no matter how much I try I am getting absolutely nothing back from WordPress.

Most functions provided by wordpress to access data are pluggable, so I want to avoid them. What I essentially need is to be able to see the details of the current logged in user, I've tried creating an extension class for WP_User but was a little stuck as to how to get anything out of it (besides, WP_User was returning 0 for everything.)

My question is: How can I grab user data? How do I know who is logged in without using pluggable functions? Would anyone mind helping?

Thanks,

Jake

1
  • This is an interesting question so I have been doing some research. It is proving difficult to find a way to get user data that isn't in some way touched by pluggable functions. Can you tell me why you must avoid pluggable functions?
    – s_ha_dum
    Commented May 6, 2015 at 13:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.