Saving custom fields for attachments
-
Hi.
I recently did this tutorial on Nettuts: http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/
The tutorial was just missing one important factor, or maybe I missed it, but I cant seem to figure out how to save the custom field data for attachments.
How would I run this function to save the data?
function my_image_attachment_fields_to_save($post, $attachment) { // $attachment part of the form $_POST ($_POST[attachments][postID]) // $post attachments wp post array - will be saved after returned // $post['post_type'] == 'attachment' if( isset($attachment['my_field']) ){ // update_post_meta(postID, meta_key, meta_value); update_post_meta($post['ID'], '_my_field', $attachment['my_field']); } return $post; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Saving custom fields for attachments’ is closed to new replies.