You should just be able to use the HTML5 download attribute for that. So just make your links look like this:
<a href="https://wordpress.stackexchange.com/questions/331391/<?php echo wp_get_attachment_image_url($id); ?>" download>Download Image</a>
where $id
is the attachment ID
Related Posts:
- Get Image Description
- Automatically replace original uploaded image with large image size
- How to scale up featured post thumbnail?
- Custom image size / thumbnail – Crop to aspect ratio even when source image is smaller than set dimensions
- wp_get_attachment_image_src and server path
- get_post_gallery_images returns thumbs . I want full size
- Change WordPress image URLs via filter
- How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
- hook into completed image upload filter
- Why is wp_get_attachment_image not including “full” size in srcset?
- Get img alt tag from a Image that has been uploaded through the Customizer
- Get Attachment ID from URL [duplicate]
- How to set twenty fourteen header image at 100% width?
- Can’t Display Featured Image in RSS Feed
- Filter to modify post_title after image upload?
- Automatically Add Caption in image
- Import Images from one self-hosted WordPress install to another
- How to Optimize images after uploading all images to WordPress Site?
- How to get relative URL of medium sized featured image?
- How do i reference the theme path in pages for images?
- Using srcsets to load different images based on browser widths
- Multiple entries for one object with different cover images
- How to exclude an image size from the WordPress srcset
- Gutenberg editor get post featured image by id
- Get full URL of images in media library including http://
- Host images only on CDN
- Generating different dimension images while uploading image file from custom plugin page
- How to intigrate multiple image uploader in a custom post type
- Stripping the_content() from images then displaying them seperately
- Image upload appearing as broken images following server move
- Regex expression for redirecting image URLs to another folder
- Background image resets after time (XAMPP)
- renaming an image automatically everywhere else (posts and pages)
- Custom thumbnail size of image when uploaded
- Change wp-content/uploads to uploads/%postname%/%image%
- Add suffix to uploaded images
- Insert File URL Links to Existing Images that Were Not Originally Linked to Themselves
- Difficulties setting a maximum image width
- How to add image in rss?
- Does wp_get_attachment_image_src also work with non-image files?
- Why does WP allow to view and media item as a page
- Console Browser says it cannot find a requested image that does not exist on my Website [closed]
- Add retina “2x” in attribute “srcset”
- Capitilize Alt/Title Tag in Image HTML, Reorder HTML Output
- How to display a sized image from Simple Fields repeatable field
- Hiding Media Source Links
- VT-resize (great alternative to timthumb) : Errors cropping (litespeed, centos 6.3)
- Allow admin roles to add images to comment replies
- Calling two images at a time? A better way?
- Random Characters in the end of every image url in post
- resize and crop thumbnail photos
- Image Captions Have a 10px Extra Margin, And It’s Not CSS? [duplicate]
- Image.php Problem – Post Images Not Displaying In It
- Broken thumbnails (sometimes) with TimThumb
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Is it possible to save crop to a different size of the image when in image editor?
- How do you change the fetched image of a PDF uploaded into WordPress Media Library?
- Apply manual image cropping not to thumbnail but medium_large size
- Hide or mask the url to an image
- Trying to change the URL of a product image once I upload it, but there seems to be no way to access the URL
- Trouble with Uploading and Displaying Images
- WordPress Multisite: Images moved to /sites/1?
- How can I insert and display copyright owner field on featured-images, pictures and galleries in articles?
- Image alt attribute
- wp_download_url() for dynamically generated image
- Non-existent child page URLs redirects to the image attachment URL instead of throwing 404
- Images not loading on wordpress.org site
- second featured post not displaying on page [closed]
- How to change img src in home-made theme, using WordPress` live customizer?
- Full size image from srcset ALWAYS used on mobile DESPITE setting size of image in editor
- Run function before uploaded image is saved
- WordPress not choosing the right image from srcset
- how to remove / hide ‘featured image’ option from side menu
- How to get attachements URL from author meta and display them?
- wordpress images not showing properly
- How can I set different banner images using background cover at different breakpoints?
- variable crop option with add_image_size()
- Replacing an Image gallery
- Missing Images in Uploads Directory (Server Only)
- Images with excerpt function
- How do I get resized thumbnails?
- Why is WordPress loading a different sized post thumbnail?
- Uploading Full Size Image vs Resizing Before Upload
- Storing images on a local site
- change with CSS the color of an svg background image set with “background-image: url()”
- Img alt tag showing different value then entered
- Adding Multiple Images to Sidebar Through Dashboard
- Tried everything but Facebook share button won’t load the post thumbnail
- Set image dimension for WP_Customize_Image_Control images
- How to hide image alt text/caption in Visual Composer?
- Delete all thumbnails & regenerate them?
- Can I turn an image into a button?
- Why are some SVG-images not visible in my footer?
- How To Get Feature Image from Blog in Same WordPress Multisite Blog on the Parent Blog?
- WPALLIMPORT Exporting images from repeater field [closed]
- What does WordPress media uploader do to image files on upload?
- Site header logo and parallax image on homepage do not display on iPhone
- Gutenberg block HTML image rendering override
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions