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
- How to get custom post meta using REST API
- The “_encloseme” Meta-Key Conundrum
- Using get_post_meta with new_to_publish
- explode array within shortcode
- Can I count the number of users matching a value in a multiple value key?
- Getting attachments by meta value
- Auto sort the wp-admin post list by a meta key
- Allow user to create instances of custom field
- Saving Custom Field in Attachment Window in WordPress 3.5
- getEntityRecord without knowing the post type
- Save HTML formatted data to post meta using add_post_meta()
- Check before publishing, if already exist post with current custom field value
- How to save custom fields for attachments
- How to get source of custom meta image?
- Stopping WordPress from Auto Generating Image Files for Sizes
- Metabox with multiple fields added by user and upload box
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom field value based on other custom field values
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Get all meta keys assigned to a post type
- Combine multiple custom field values into single value
- How to query posts with certain custom meta data, and output Post data
- Can’t get post ID using wp_insert_post_data
- Unique Post Meta Values
- Add post meta fields, when creating a post using WordPress’ REST API
- Store array as single, serialized post meta field or many post meta fields?
- Custom Field Values not updating unless I click “Update” twice
- Better way to save image in custom field
- update_post_meta for repeated custom field [closed]
- get_posts in meta box dropdown not showing latest posts
- Select multiple images from custom field
- Ordering posts by custom field named “date” in backend
- Unique meta_key with array value vs repeated meta_key with single values
- Can’t save custom field on registration page
- Allow only one post with specific meta value
- How to validate select field in post meta?
- 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
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- How to fill custom fields with brackets in their key with add_post_meta()?
- change order of images attached to post
- Retrieving post meta array (attachment)
- how can I show name and value of Custom Fields together?
- No result update a custom field using wp_schedule_event
- Gravity Forms Update post meta from template [closed]
- put saved metabox values back into fields and then display on the front end
- Selectively hiding or allowing thumbnails of featured images on front page
- wp_get_attachment_image_src() with advanced custom fields returning empty
- wordpress multi user question
- Users uploaded image and matching an id or taxonomy
- Conditionally run function based on custom meta value?
- How can I change author of posts to the value of one of the custom field of the posts?
- Adding Custom Metadata to my Archive/Posts page
- How to improve my non-unique metadata MySQL entries?
- Saving Custom Field that includes Quotation marks
- Custom Fields Not Showing (ACF not installed)
- Post meta data not showing in frontend, until hitting ‘update’ button
- searching by keywords in post’s metas or pagination links problem
- How do I update custom field post meta in frontend post template?
- How to Find List of Available Custom Fields for Theme?
- update meta field value after
- Custom Fields Not Working In Footer
- ACF plugin and field update
- Delete custom post type metadata without deleting the post in admin area
- Echo out custom fields in comments
- Search one custom field?
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- Save values generated via API as custom meta fields
- Adding custom fields to images
- How to save dynamically generated value in post type?
- update_post_meta not working in action hook
- how to show this part only in the single post page?
- Display meta data from a custom field within plugin Category Grid View Gallery
- If post custom meta data is not set, show normal state
- How do i output images from URL’s added to the same custom field key
- custom field with links
- add multiple values (array) to post meta_input
- save all acf options in one meta_value [closed]
- WP Query Args – search by meta_key or title