Last Updated: February 25, 2016
·
763
· codebyjeff

A Better WordPress User Object

1 Response
Add your response

If you look at the source for WPUser - https://github.com/WordPress/WordPress/blob/master/wp-includes/capabilities.php#L406 - you would see that it also implements the `get(),isset()and_set()` magic methods.

It's also important to know that a single call to get_user_meta() loads all of the users meta fields into the WP object cache. This way any subsequent calls to either get_user_meta() or WP_User::__get() would not require a trip to the DB.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#wordpress
Did you know?

WordPress sites collect scripts from themes, plugins, and tag managers. A compromised plugin update can add a skimmer to every page without a change in your own templates.

Security insights from Cside