Title: Accessing data in user meta nested array
Last modified: December 7, 2020

---

# Accessing data in user meta nested array

 *  Resolved [danielticchnl](https://wordpress.org/support/users/danielticchnl/)
 * (@danielticchnl)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-data-in-user-meta-nested-array/)
 * Hi,
 * Enjoying the plugin. I was wondering if there is a way to access the data stored
   in a array in a user’s meta data. Specifically I need to access data in an array
   called wp_capabilities. Here’s an example diagram for the data structure:
 *     ```
       [user_meta_data] => Array
       (
           [wp_capabilities] => Array
               (
                   [0] => a:2:{s5:"role1";b:1;s:5:"role2";b:1;}
               )
       )
       ```
   
 * I need to content to show if this wp_capabilities contains either “role1” or “
   role2”.
 * I’ve tried using contains for either role, and I’ve tried using in_array and 
   added both text values to no avail. Any ideas?
    -  This topic was modified 5 years, 5 months ago by [danielticchnl](https://wordpress.org/support/users/danielticchnl/).

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

 *  [nyladenise](https://wordpress.org/support/users/nyladenise/)
 * (@nyladenise)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-data-in-user-meta-nested-array/#post-13783199)
 * If you find a solution, please post here. I think I’m looking for the same thing—
   to show or hide content based on user role.
 *  Plugin Author [crazypsycho](https://wordpress.org/support/users/crazypsycho/)
 * (@crazypsycho)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-data-in-user-meta-nested-array/#post-13821496)
 * Hi [@nyladenise](https://wordpress.org/support/users/nyladenise/) and [@danielticchnl](https://wordpress.org/support/users/danielticchnl/),
 * if the only goal is to check the user role, you can use our other plugin
    [https://wordpress.org/plugins/dynamictags/](https://wordpress.org/plugins/dynamictags/)
 * This provides some useful DynamicTags, including one for the user role.

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

The topic ‘Accessing data in user meta nested array’ is closed to new replies.

 * ![](https://ps.w.org/dynamicconditions/assets/icon-256x256.jpg?rev=1969812)
 * [Dynamic Conditions](https://wordpress.org/plugins/dynamicconditions/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dynamicconditions/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dynamicconditions/)
 * [Active Topics](https://wordpress.org/support/plugin/dynamicconditions/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dynamicconditions/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dynamicconditions/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [crazypsycho](https://wordpress.org/support/users/crazypsycho/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-data-in-user-meta-nested-array/#post-13821496)
 * Status: resolved