Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2010 19:17
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Adding an "author" dropdown to the Media Uploader
// Just an example. Probably doesn't work.
add_filter('attachment_fields_to_edit', 'add_media_author_field', 10, 2);
add_filter('attachment_fields_to_save', 'save_media_author'), 10, 2);
function add_media_author_field($fields, $post) {
// add the dropdown to $fields
$fields['media-author'] = array(
'label' => __('Credit:'),
'input' => 'html',
'html' => wp_dropdown_users( array( 'echo' => 0 );
return $fields;
function save_media_author($post, $attachment) {
$attachment->post_author = $_POST('media_author');
return $post;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment