You may try the filter wp_get_attachment_link
// definition: apply_filters( 'wp_get_attachment_link', "<a href="" . esc_url( $url ) . "">$link_text</a>", $id, $size, $permalink, $icon, $text, $attr );
// this filter provide a max. of 7 arguments, I use 2 in the example
add_filter( 'wp_get_attachment_link', 'q363693_update_attachment_link', 10, 2 );
function q363693_update_attachment_link( $url, $id ) {
// some codes
$new_link = "<a href="" . get_permalink( $id ) . "">your own text or anything you need or add more arguments to use the original text...</a>";
return $new_link;
}
Related Posts:
- getting attachement images src and add classes
- How can I bulk delete media and attachments using WP-CLI?
- Are captions stored anywhere?
- get_the_post_thumbnail() doesn’t taking style attribute
- How can I UN-attach media from a post?
- complex restriction of items in media library
- Remove duplicate attachments
- Edit image / Delete image link
- How could I add button next to “edit image” button in “Attachment Details”
- media_sideload_image file name?
- Detect if is image unattached
- How to get attachments for a specific post type?
- Give attachments an archive page
- Insert Media – Attachment – Link to : Remove the “attachment page” option
- Show Post ID in “Find Posts or Pages” box in Media Library?
- Retrieving a custom link on an attachment
- Delete attachments from Front end
- Creating a multi-file upload form on the front end for attachments
- get post attachments of a particular size
- Make individual attachments private?
- How to upload image from front end and save in media library?
- Get the attachment URL on single.php
- How to count media attachments?
- How to create a CSV on the fly and send as an attachment using wp_mail?
- How to add attachment without uploading?
- Prevent Duplicate Attachment When Using wp_insert_post
- Attachment 0×0 size error [closed]
- Add image attachment to post via coding?
- Change filename during upload
- Contact Form 7 Data As Attachment [closed]
- Get post attachment images dimension and use in embed code
- Post Via Email – How to send Attachments with it (e.g. PDF File or JPEG Image)?
- How do i add LIGHTBOX to Attachments?
- How to specify width and height in the_content for image attachments
- delete image attachments of a custom post type except featured image
- Display attachment resolution size
- Custom Gallery HTML only working when images are attached to post/page
- Import Attachments – not attaching to post_parent
- Where does the gallery shortcode gets its attachments from?
- How do I link an image to the post it is attached to?
- media ‘path’ issue / concern when bringing files live
- How to redirect ‘file url’ to ‘post url’ i.e. in attachment.php
- Is it possible to share media files between multiple WordPress sites?
- How can I attach Facebook Open Graph data to an Attachment Page?
- Open the Attachment Details popup
- Attachment page 404
- Set Attachment Image File URL as GUID
- How to compress image before inserting to wordpress using wp_insert_attachment function?
- Getting “too many redirects” when using wp_redirect for attachment page
- How to update the title of audio file through its attachment metadata
- Change default selection for “Embed or Link”?
- How to allow empty title for attachments?
- How can I make an attachment page for pdf uploads?
- Proper use of wp_get_attachment_image?
- Get title of post image is attached to
- the_time() returning wrong date/time (way in the future)
- Add audio attachment link to RSS
- Correct attachment size
- How to: Retrieve an attachment image from post and output it
- Get image attachment to a post outside the loop?
- Could not get attachment using wp_mail
- Looking to limit file attachment downloads
- Echo list attachment size in post
- How do I intercept and modify the functionality of wp_get_attachment_image()?
- Undoing define( ‘UPLOADS’, ”.’files’ ); to repoint to “wp-content/uploads” folder
- How can i catch (with get_posts) attachment file (pdf, images) from a post when i have only inserted it from media library and it isn’t upload for it?
- WordPress Gallery Permalink Structure Displaying Incorrectly
- Upload image and assign it’s id to post
- How to get thumbnail from post attachment in this loop
- i want attachment.php to return the image
- How can I rewrite old attachment URLs?
- How can I customize the link when an attached image is clicked?
- Add a word to the first // wp_get_attachment_url // as the subdomain name
- How to view exact image dimensions of a media in Admin view?
- wp_get_attachment_image_src calling wrong location
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Get attachment URL from attachment Link in WordPress
- How to open an attachment based on the date picker
- Send data URL string as an attachment in wp_email
- How to use previous/next image link, ignoring parent posts/attachments?
- Using $_FILES variable into the same function for uploading images and files
- WP media attachment location vs permalink
- Removing delete permanently button in uploading files media
- Remove attached media
- Incomplete attachment page
- How to retrieve “custom url” from image attachment in wordpress
- list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not
- Custom attachment field dissapearing
- How can I let users access a specific attachment?
- What is the most efficient way to retrieve a group of image URL’s from different attachment ID’s of a specific crop size?
- How to wrap this Link with an Image?
- WordPress Attachments vs Post Meta
- How to save media-form on custom tab
- open image after clicking on single.php with different stylesheet in wordpress
- How do I get link URL (not file URL or attachment URL) of an attached image [duplicate]
- Attachment page custom title?
- I want to edit documents on my blog without the need to download and upload files again [closed]
- Open attachments in new tab/window
- One audio attachment, with two possible interchangeable extensions
- Attachement Meta DATA