Skip to main content
3 votes

How to set default value for 'Alt text' on image upload dialog?

Ok, the answer will not be short At first, You can't change the alt attribute using attachment_fields_to_edit, because you can't modify default fields. To see how this works can be in the source code ...
vralle's user avatar
  • 201
3 votes

Official documentation for attachment form fields

TL;DR : I guess there's no official and complete documentation, not even in the source. html in a $form_fields is used for custom HTML markup, if you decide not use the provided options. Longer ...
Celso Bessa's user avatar
  • 1,118
1 vote
Accepted

Post edit - Media Library - Only get images from current post

This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels. Add this code to your function.php file add_action( '...
Tejas Gajjar's user avatar
1 vote
Accepted

Save attachment custom fields on front end

On the back-end, you're retrieving the data like this: $meta = $_POST['attachments'][ $post_id ]['photo_time']; $meta_two = $_POST['attachments'][$post_id]['photo_order']; So on the front-end, you ...
Sally CJ's user avatar
  • 39.9k
1 vote

Is there a native wp.media way to detect who "opened" wp.media.frame

I think I got it , if (wp.media) { wp.media.view.Modal.prototype.on('open', function(data) { console.log(wp.media.frame.modal.clickedOpenerEl); }); } let me know if there is better ...
Benn's user avatar
  • 1,043
1 vote

How to set default value for 'Alt text' on image upload dialog?

I found a solution to add a default caption for all new uploaded attachments: function add_caption_to_attachment($data, $postarr){ if(empty(trim($data['post_excerpt']))){ $data['post_excerpt'] =...
bubblez's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible