Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to add a line of text under the description field in the media edit form to give users more direction as to how to fill out this field. What is the best way to do this? I know how to add form fields, but can't seem to figure out how to modify existing ones.

I added

unset($form_fields['post_content']); 

but for some reason this doesn't seem to remove the default description field.

Thanks!

share|improve this question
add comment

1 Answer

Would maybe look into do_action( 'pre-upload-ui' );.

Here is my first thoughts, please note it's not tested but should get you in the right direction.

add_action( 'pre-plupload-upload-ui', 'sd_extra_info' );

function sd_extra_info()
{
    # see wp-includes/media-template.php
    print '<pre> Some more info here </pre>';
}
share|improve this answer
1  
Two notes: Aside from some minor exceptions, all filters and hooks use underscores _ instead of dashes - for separation. Then there's the point that I can't find pre_plupload_, pre-upload or similar strings in the WordPress source. Are you sure about that? –  kaiser Oct 31 '13 at 0:29
    
@kaiser, I'm afraid there is (I've searched for -plupload-, those hooks gotta be left overs of some party barbecue wpcamp:). stevie's code results in this –  brasofilo Oct 31 '13 at 1:32
    
@brasofilo thanks, mate :) wtf did the one who added that name drink? oh, and I used GitHub search on WordPress/WordPress mirror repo. –  kaiser Oct 31 '13 at 11:48
    
Thanks, but I think I used the wrong name for the field I'm trying to modify. I need to modify the description field when a user uploads media from the add new post page. See photo: imgur.com/nlAvSyR I've figured out how to add new fields here, but need to modify the existing description field. I added in a field with just help text, but can't make it not display a text input field. Also, I guess this field also appears in the edit media page after the media item is uploaded. Thanks again, sorry for not making that more clear. –  Sean Henderson Oct 31 '13 at 15:29
    
I think I can do what I need by using the attachment_fields_to_edit hook and deleting the description field and then adding back a modified version of it. My problem is that unset($form_fields['post_content']); will not remove the field and I'm not sure why. ??? –  Sean Henderson Oct 31 '13 at 17:39
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.