So typically when I want to get a new user object in WP I do something like this:

$user = wp_get_current_user();

The default user class is nice...but it would be handy to give it more functionality with additional functions. How would I do that?

I know you can start with something like:

class Manager extends WP_User {public function get_manager_role() {return "test";}}

But what is a good of instantiating this with all the data a user object would already have? wp_get_current_user() is nice but would return a WP_User object and not a Manager object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.