liperuf

Saving WP Media Gallery custom fields

Apr 26th, 2011
193
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function save_custom_media_gallery_fields($post, $attachment) {
  2.     if( isset($attachment['custom_link']) ){
  3.         update_post_meta($post['ID'], '_custom_link', $attachment['custom_link']);
  4.     }
  5.     return $post;
  6. }
  7. add_filter("attachment_fields_to_save", "save_custom_media_gallery_fields", null , 2);
RAW Paste Data