Save image to custom meta box 1

Save image to custom meta box

function save_joe_details($post_id){
  global $post;
  if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
  return $post_id;
  update_post_meta($post->ID, "custom_field_image", $_POST["custom_field_image"] );
}
add_action('save_post', 'save_joe_details');

Here is what the above code is Doing:
1. We’re creating a custom meta box called “Joe Details”
2. We’re adding a custom field called “custom_field_image”
3. We’re saving the value of the custom field when the post is saved

Similar Posts