Title: user data as a global array?
Last modified: February 4, 2022

---

# user data as a global array?

 *  [arathra](https://wordpress.org/support/users/arathra/)
 * (@arathra)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/user-data-as-a-global-array/)
 * We have a site with 40k+ users, each of whom has a profile with about 40 pieces
   of information about them. At the moment for each page a user visits this info
   is collected from the db and used on the page’s plugin. (We have lots of small
   in-house plugins doing various things depending on their profile info.)
 * But would it be possible/faster/easier if we collected an array of profile info
   when a user logged in and passed it from page to page (i.e. plugin to plugin)
   using a global array variable?
 * Or perhaps keep it always at hand using some other system?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/user-data-as-a-global-array/#post-15329665)
 * If the data is repeatedly used during the same request, there is advantage to
   caching data in a global. A global already exists for such use, [the WP object cache](https://developer.wordpress.org/reference/functions/wp_cache_add/).
   Between requests it wouldn’t accomplish anything because the cache must be rebuilt
   each time.
 * There are various ways to pass data between requests, but for logged in users
   I think there’s little to be gained over fetching data once from the DB. What
   you want to avoid is repeatedly getting the same DB data during one request.
 *  Thread Starter [arathra](https://wordpress.org/support/users/arathra/)
 * (@arathra)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/user-data-as-a-global-array/#post-15331288)
 * Thanks, I’ll take a look at the WP Object Cache.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘user data as a global array?’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [arathra](https://wordpress.org/support/users/arathra/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/user-data-as-a-global-array/#post-15331288)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
