3 edited tags
| link
2 Added code
source | link

I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this.

add_action('save_post', 'save_details'); 
function save_details()
{ 
    global $post;
    update_post_meta($post->ID, "price",        $_POST["price"]        );
    update_post_meta($post->ID, "shipping",     $_POST["shipping"]     );
    update_post_meta($post->ID, "long_title",   $_POST["long_title"]   );
    update_post_meta($post->ID, "upload_image", $_POST["upload_image"] );
}

I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this.

I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this.

add_action('save_post', 'save_details'); 
function save_details()
{ 
    global $post;
    update_post_meta($post->ID, "price",        $_POST["price"]        );
    update_post_meta($post->ID, "shipping",     $_POST["shipping"]     );
    update_post_meta($post->ID, "long_title",   $_POST["long_title"]   );
    update_post_meta($post->ID, "upload_image", $_POST["upload_image"] );
}
1
source | link

Custom field values get deleted

I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this.