I am trying to store SNS share value + comment count on my postmeta, DB. I put code below to accomplish this task,
function get_sns_share($post_ID=0) {
$url1=get_permalink($post->ID);
$src = json_decode(file_get_contents('http://graph.facebook.com/' . $url1));
$share_count = $src->shares; // facebook commnet + comment like + share + like
$my_var = get_comments_number( $post_id ); // comment count
$social_score = $share_count + $my_var + $tweet; // social score sum
if ($social_score > 999) $social_socre = 999;
return $social_score;
update_post_meta($post_id, '_social_score', $social_score);
}
The problem is this code certainly do works every field other than update_post_meta. It seems it does not add add post meta field to my database, thus I cannot get any value from there. Your help would be much appreciated.