Title: get_post_meta ads an extra &#8220;array&#8221;?
Last modified: August 19, 2016

---

# get_post_meta ads an extra “array”?

 *  Resolved [JesperT](https://wordpress.org/support/users/jespert/)
 * (@jespert)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/get_post_meta-ads-an-extra-array/)
 * Hello
    When I save an array with _get\_post\_meta_ I’ll get an extra array as
   this:
 *     ```
       Array
       (
           [0] => Array
               (
                   [0] => http://www.yahoo.com
                   [1] => http://www.internet.com
                   [2] => http://www.google.com
                   [3] => http://www.cnn.com/
                   [4] => http://www.php.net/
               )
   
       )
       ```
   
 * So when I gonna write it out I have to write like this:
 *     ```
       $a = get_post_meta(1,'my_key');
   
       for($i=0;$i<count($a[0]);$i++) {
           echo $a[0][$i].'<br />';
       }
       ```
   
 * Why this?

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

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/get_post_meta-ads-an-extra-array/#post-1361966)
 * Does this change things:
 * `$a = get_post_meta(1,'my_key',TRUE);`
 * The TRUE says to return a single value (which for you is an array), not an array
   of all values for that key (an array of arrays). See the Codex [here](http://codex.wordpress.org/Function_Reference/get_post_meta).
 *  Thread Starter [JesperT](https://wordpress.org/support/users/jespert/)
 * (@jespert)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/get_post_meta-ads-an-extra-array/#post-1361994)
 * Aha, of course. Thank you **very** much!

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

The topic ‘get_post_meta ads an extra “array”?’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [JesperT](https://wordpress.org/support/users/jespert/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/get_post_meta-ads-an-extra-array/#post-1361994)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
