Time and again i fall for this same simple mistake.
This may not be intuitive in the context of serialized arrays. If you fetch a serialized array with this method you want
$single
to betrue
to actually get an unserialized array back. If you pass in false, or leave it out, you will have an array of one, and the value at index 0 will be the serialized string.
You see; if you have created a simple indexed array like $my_simple_array = array($someval);
and stored it as custom field, you want to set single
to true
. Otherwise, the values you’d normally add like : $my_simple_array[]=$someotherval
will be inserted as new arrays instead of string and you will end up with a mess like in the picture