I have this small piece of code that doesn't work when i MOVE a WordPress website to another location, (IT DOES WORK ON THE ORIGINAL LOCATION):
function displayCustomFields() {
global $post;
$rt_gallery_images = get_post_meta( $post->ID, "rtthemert_gallery_images");
var_dump ($rt_gallery_images);
}
var_dump displays:
array( 0 => boolean false )
But if I remove the meta_value like the following code :
function displayCustomFields() {
global $post;
$rt_gallery_images = get_post_meta( $post->ID);
var_dump ($rt_gallery_images);
}
the var_dump shows:
'rtthemert_gallery_images' => array
0 => string 'a:1:{i:0;s:72:"/ssold/wp-content/uploads/2012/10/picture-3.jpg";}' (length=81)
and the rest of the meta values
I have exactly the same code in both location, why it works on the original and not on the copy ?
I realized what was the problem, the db has been migrated and some serialized data has been mistakenly edited. I was able to solve this by running the code on the following page: http://alexscammon.com/2011/06/migrating-wordpress-blogs-fixing-the-serialization/