You can create a filter using the “wp_get_attachment_image_attributes” hook. Place this in your functions.php file.
function filter_image_title($attr, $attachment = null){
//Find your $photographer with $attachment->ID
$attr['title'] .= ' (' . __('Photographed by', 'foobar') . ' ' . $photographer . ')';
return $attr;
}
add_filter('wp_get_attachment_image_attributes', 'filter_image_title', 10, 2);
Related Posts:
- copy attachments to another post type and change attachment url
- Remove Dimension from wp_get_attachment_image
- Add multiple images to a page sidebar
- Get updated meta data after save_post hook
- Add custom field to image editor
- post meta data clearing on autosave
- Update meta values with AJAX
- ajax delete value from custom field array
- Save attachment custom fields on front end
- Custom field not updating when value is empty
- How to get custom image field of specific post id
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- How to delete attachments associated with custom field type when post property changes? [closed]
- change attachment custom field onChange event
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Adding thumbnails for non-image attachments
- wrap text around custom fields array
- How can I modify RSS item titles to be either the title or a custom meta field?
- Displaying page image in the footer automatically
- Avoiding ACF get_field and returning to core WordPress function
- Get image url using image id
- Can’t save custom field on registration page
- Unable to get specific value from post meta
- Problem with saving large amount of data in postmeta/usermeta
- Custom meta is not being saved
- Link FROM attachment to full post and get custom fields values on attachment page?
- How to get posts with a metadata numeric key greater than X?
- Allow only one post with specific meta value
- Get all the posts where meta field with multiple choice has several values checked
- wordpress custom loop ascending descending posts by custom field
- Move Title and the Content WYSIWYG editor position
- How to validate select field in post meta?
- Show image if author meta (profile fields) exists outside loop
- IF Custom field value equals ZERO
- How to display childrens custom fields?
- Attach images to posts using custom fields (just paths to images already uploaded)
- how to display custom fields of post on a web page
- Hide custom fields when empty
- How to use media upload on metabox post page without breaking TinyMCE?
- How do i get the attached images with custom value checked?
- Convert attachment ID into url?
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- Let’s Create Custom Field Template Documentation
- Save all the post tags inside a custom field
- How to fill custom fields with brackets in their key with add_post_meta()?
- Branch made by several custom values
- What are the meta fields for an attachment?
- Looping inside block return
- How add multiple wp_editor_box to new post
- Update post meta custom field using block editor
- copy images from custom field to another custom field
- WordPress creates new lines in postmeta table on post update
- change order of images attached to post
- User customising position of WordPress Featured Image
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- Retrieving post meta array (attachment)
- how can I show name and value of Custom Fields together?
- Can I save post meta programatically without setting metaboxes?
- Custom field as featured image caption
- Display posts with empty custom field
- Insert image into sub-field with update_post_meta
- Add a custom class to the body tag using custom fields
- Best Way to get facebook share count and update using wp_schedule_event or any other method
- No result update a custom field using wp_schedule_event
- Get YouTube video id from url in a custom field
- Show custom field on attachment page?
- Related query shows same image in loop
- How to use conditional statement with custom field
- Why am I getting a “Call to member function format() on a non-object” error?
- Can’t Output get_post_meta?
- Display a different image for each page with editor
- Save attachment ID instead of URL in custom field
- Meta box values are displayed on Custom Fields list. Is it possible to hide them?
- If metabox has content display content
- Gravity Forms Update post meta from template [closed]
- put saved metabox values back into fields and then display on the front end
- Modify custom field from front end
- Best way to achieve multiple links in a post title
- Footnotes in custom fields
- Image upload and path to custom field
- Create a new custom field for all posts based on current custom field
- Display Meta Data with HTML?
- How can I add/update post meta in a admin menu page?
- wordpress get_post_meta / the_meta to output custom field value
- Custom Query: query by post custom meta data
- Selectively hiding or allowing thumbnails of featured images on front page
- wp_get_attachment_image_src() with advanced custom fields returning empty
- Get author total post votes from post meta
- get_post_custom_values problem, please help
- Group Posts By Custom Meta Value: Date
- custom filed from post in the side bar
- wordpress multi user question
- Unable to select image with custom field
- Users uploaded image and matching an id or taxonomy
- Using Custom Fields to Trigger Specific Actions on Saving a Post?
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Conditionally run function based on custom meta value?
- update_post_meta not working well
- How can I change author of posts to the value of one of the custom field of the posts?
- How to display custom fields in hestia theme