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 ...
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 ...
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( '...
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 ...
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 ...
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'] =...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
attachment-fields-to-edit × 32attachments × 20
custom-field × 9
images × 8
media-library × 5
uploads × 4
customization × 3
media × 3
plugins × 2
posts × 2
filters × 2
post-meta × 2
gallery × 2
media-modal × 2
custom-post-types × 1
plugin-development × 1
wp-query × 1
wp-admin × 1
pagination × 1
admin × 1
post-thumbnails × 1
actions × 1
advanced-custom-fields × 1
forms × 1
post-editor × 1