Updating wordpress user meta data array (unexpected multiple arrays)

It looks like get_user_meta() returns an array like such.

array(2) {
   [0]=>
       array(1) {
           [0]=>
       }

   [1]=>
       array(1) {
           [0]=>
       }
}

Then when update_user_meta() stores the array it sticks it inside another array like this.

Edit: As it turns out get_user_meta() is encapsulating the result in an array when it grabs it.

array(1) {
    [0]=>
        array(2) {
           [0]=>
               array(1) {
                   [0]=>
               }
           [1]=>
               array(1) {
                   [0]=>
               }
        }
}

Then later it’s retrieved and saved again adding a new level each time.

There’s a simple, although counter-intuitive, solution to this problem. Set the last parameter of get_user_meta() to true.

get_user_meta($id,$key,true);`

If it is false it returns an array and if it is true it returns a single value which could be an array itself.

More info is available here. https://stackoverflow.com/questions/7746887/storing-php-arrays-in-wordpress-user-meta-database