Apparently the serialized data got corrupt, calling the field by query got me this error. WordPress does not return an error when the serialized data is corrupt just a bool(false).
Solved this by insert/update the serialized data in a base64_encode() and call it with base64_decode(). This seems to do the trick and data can be called again from the function.
Wrote a small functions for myself
Maybe there is someone with the same issue, i’ve wrote this small function to check.
<?php
function wpgz_post_meta( $post_id, $meta_key="", $base64_decode=false )
{
if( intval($post_id) )
{
$post_meta = get_post_meta( $post_id, $meta_key, true );
$post_meta = $base64_decode !== false ? base64_decode($post_meta) : NULL;
$post_meta = explode(PHP_EOL, $post_meta);
$post_meta = unserialize($post_meta[0]);
if( is_array($post_meta) )
{
return $post_meta;
}
else {
send_page_notice("danger", "Invalid format", "Returned value is not a valid array.");
}
}
else {
send_page_notice("danger", "Invalid input", "The first value for this function should be an integer number.");
}
}