Programming rookie back again.
I have been studying the add_action('save_post','')add_action('save_post','')
but I am having difficulty getting it to work for my needs. The concept is simple - update the database information for an attachment's meta info.
Here's where I'm at. I have my add_meta_boxadd_meta_box
working great with an input box that is pre-populated with the Camera information from image meta.
If I make an edit in this Camera field and update the post, no matter what variation of update_post_metaupdate_post_meta
I try, it's failing. For example:
$camera = $imgmeta['image_meta']['camera'];
$update = $_POST['exif_field_camera'];
update_post_meta($post_id, $camera, $update);
I am fearing a horrible rookie mistake here, since it's not working.
The code I am using to retrieve the information and using it as part of my add_meta_boxadd_meta_box
is:
$args = get_posts( array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
) );
foreach ($args as $attachment) {
$imgID = $attachment->ID;
$imgmeta = wp_get_attachment_metadata($imgID);
$camera = $imgmeta['image_meta']['camera'];
}
What would the code be to write the new Camera input box information?