Use wp_get_attachment_image_src()
and build a simplified img
element. You may use something like the following code as a replacement for wp_get_attachment_image()
:
function wpse_53524_get_image_tag( $attach_id, $size, $icon, $alt="" )
{
if ( $src = wp_get_attachment_image_src( $attach_id, $size, $icon ) )
{
return "<img src="https://wordpress.stackexchange.com/questions/53524/{$src[0]}" alt="$alt" />";
}
}
Put the function above into your theme’s functions.php
. Call it like wp_get_attachment_image()
:
foreach ( $attachments as $attachment ) {
echo wpse_53524_get_image_tag( $attachment->ID, 'full', false );
}
Related Posts:
- 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
- How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
- 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?
- WordPress speed slow after .5 million single image post via wp-cli
- Is it possible to prevent users from uploading small images?
- how to base64 encode images in wordpress template
- get_children – wp_get_attachment_image
- Generate fixed image sizes for different pages, eliminate sizes during upload
- Setup A Default Featured Image
- Find posts without featured image? [duplicate]
- How do I add a featured image to a single post page?
- Custom image size not regenerating when image editted
- How can I autopopulate titles in the media library?
- How to disable the suffix “-scaled” which is being added at the end of each uploaded image?
- Image still linked as attachment to page even though it has been deleted
- Disable wordpress image sizes generation
- In media library images are not displaying run time [closed]
- Best option for photo/gallery handling?
- Frontend Post – Allow Only Image File Upload
- Add a new data attribute in tag
- Plupload resize for worpdress
- File format of post image attachment
- How to display a different image size for mobile
- Photography Based Design – Multiple Images Per Post
- SEO images in Nextgen Galleries
- Remove Size images without use
- Woocommerce featured image of page – not product
- Can’t seem to attach uploaded image to post and set it as thumbnail
- Add an attribute to attachments
- Include caption underneath post images
- Domain Change with New Image Sizes
- Why no images on a fresh WordPress installation?
- How to prevent WordPress scaling large images down
- How to stop thumbnail generation from some images and different size thumbnail generate
- wordpress (woocommerce) add image to media library programmatically python
- How can I filter image HTML to add schema.org attributes?
- wp_customize_image_control deprecated add_tab alternative
- How to translate get_intermediate_image_sizes?
- Change media URL (images)
- Problem with images when no dimension in the URL [closed]
- some images not appearing on the website after migration [closed]
- Why does WordPress convert my jpg’s to png?
- How do I get my main image to stretch the full length of the screen?
- How to make my site use HTTPS for images or how to insert images as relative paths?
- HowTo: develop WP template with dynamic background image
- How can I use wp_save_image_editor_file filter?
- Featured Image or Post Thumbnail Displaying on index.php?
- How to set featured image from external url programmatically
- What did I do WRONG?
- Add retina “2x” in attribute “srcset”
- Capitilize Alt/Title Tag in Image HTML, Reorder HTML Output
- Change logo image condition based on url
- How to display a sized image from Simple Fields repeatable field
- Hiding Media Source Links
- Random Characters in the end of every image url in post
- resize and crop thumbnail photos
- Broken thumbnails (sometimes) with TimThumb
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Why is my table background image not showing in wordpress?
- 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?
- Site only working in browser where I created it
- Image alt attribute
- wp_download_url() for dynamically generated image
- 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
- Are WP images responsive by default?
- 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
- Images with excerpt function
- How do I get resized thumbnails?
- How do I embed an image at actual size?
- Display ajax preloader for large images within posts
- Why is WordPress loading a different sized post thumbnail?
- Uploading Full Size Image vs Resizing Before Upload
- Storing images on a local site
- 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?
- How to import external media items into wordpress media library (without using storage)
- Images uploaded in customized gallery do not link to media
- WordPress Site Broken and it gives Headers Already sent error