WP update_post_meta not updating

I can’t seem to get the values to update correctly. They initially save data when entered when creating the post, but will not update afterward. I’ve looked everywhere but have found no answers. Can anyone tell what’s wrong? All help is appreciated.

function casestudy_save_meta($post_id, $post) {

    global $post;

    if ( !current_user_can( 'edit_post', $post->ID ))
        return $post->ID;

    // Put it into an array to make it easier to loop though.
    $casestudy_meta['link'] = $_POST['link'];

    foreach ($casestudy_meta as $key => $value) {

        if( $post->post_type == 'casestudy' ) return;
        // Don't store custom data twice
        $value = implode(',', (array)$value);
        if(get_post_meta($post->ID, $key, FALSE)) {
            // If the custom field already has a value
            update_post_meta($post->ID, $key, $value);
        } else {
            // If the custom field doesn't have a value
            add_post_meta($post->ID, $key, $value);
        }
        if(!$value) delete_post_meta($post->ID, $key);
    }
}
add_action('save_post', 'casestudy_save_meta', 1, 2);


Download wp.update.post.meta.not.updating.zip
Direct Link


Download


Download wp.update.post.meta.not.updating.zip
Mediafire


Download


Download wp.update.post.meta.not.updating.zip
Ziddu


Download


Download wp.update.post.meta.not.updating.zip
Zippyshare


Download


Download wp.update.post.meta.not.updating.zip
Billionuploads


Download

Both comments and pings are currently closed.

Comments are closed.