I'm adding post meta for custom post type. The meta value is an array
Array (
'value',
'value',
'value'
)
Using add_post_meta() works fine, but when I retrieve post meta, it returns a multi-dimentional array
Array (
[0] => Array (
[0] => value,
[1] => value,
[2] => value
)
)
Why is a multidimentional array returned when I'm using the following
$myarray = get_post_meta( $postid, 'meta_key', false );
Syntax for get_post_meta as state below reference link is
https://developer.wordpress.org/reference/functions/get_post_meta/
get_post_meta ( int $post_id, string $key = '', bool $single = false )
Retrieve post meta field for a post.
Return: (mixed) Will be an array if $single is false
. Will be value of meta data field if $single is true.
Try something like below
get_post_meta( $postid, 'meta_key', true );