Title: Custom field array
Last modified: August 21, 2016

---

# Custom field array

 *  Resolved [roylodder](https://wordpress.org/support/users/roylodder/)
 * (@roylodder)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/custom-field-array-1/)
 * Hi There!
 * I’m working on an existing WordPress website. The site uses custom fields and
   one field is populated with an array.
    The custom field is called “items” and
   I need the value of the “description” key.
 * Custom field name: items
    Array key I need the value of: description Array: `
   a:33:{ s:4:”name”; s:8:”janedoe”; s:4:”language”; s:18:”English, Dutch”; s:12:”
   hobbies”; s:0:””; s:7:”work”; s:0:””; s:12:”description”; s:48:”Lorem ipsum dolor
   sit amet, consectetur adipisicing elit. Aperiam, soluta!”; }`
 * Is there an easy way to do this?
 * Best Roy

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

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/custom-field-array-1/#post-4006613)
 * There’s two ways ot do this depending on how that information is returned from
   the call to `get_post_meta()`. From what I’ve seen before, any arrays that are
   stored are normally unserialized into an array correctly and if that’s the case
   you can just get the value from the array.
 * `$value = $array ['description'];`
 * If the value is returned as a string that looks like you’ve got it there you’ll
   just need to unserlaize it yourself to get the values.
 *     ```
       $array = unserialize ($array);
       $value = $array ['description'];
       ```
   
 *  Thread Starter [roylodder](https://wordpress.org/support/users/roylodder/)
 * (@roylodder)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/custom-field-array-1/#post-4006736)
 * Thanks! Stupid that i didn’t try that.
    Went with the following
 *     ```
       $array = maybe_unserialize($array);
       $value = $array ['description'];
       ```
   

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

The topic ‘Custom field array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [roylodder](https://wordpress.org/support/users/roylodder/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/custom-field-array-1/#post-4006736)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
