liperuf

Changing WP Media Gallery Fields

Apr 26th, 2011
263
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function custom_media_gallery_fields($form_fields, $post) {
  2.     $form_fields["custom_link"] = array(
  3.         "label" => __("External URL"),
  4.         "input" => "text",
  5.         "value" => get_post_meta($post->ID, "_custom_link", true), // save as meta
  6.         "helps" => __("Your external link.")
  7.     );
  8.    
  9.     unset( $form_fields['url'] ); // [optional] remove original URL field
  10.    
  11.     return $form_fields;
  12. }
  13. add_filter("attachment_fields_to_edit", "custom_media_gallery_fields", null, 2);
RAW Paste Data