I’m sure some plugin or your theme modifies your attachment url.
Try to find wp_get_attachment_url
hook in your code or simply create your own with high priority this way:
add_filter('wp_get_attachment_url', function($url) {
return preg_replace("~^//(.+)$~", "https://$1", $url);
}, 999);
or better:
add_filter('wp_get_attachment_url', function($url) {
return set_url_scheme($url, 'https');
}, 999);
But I recommend you to find the reason of this attachment url behavior first.
Related Posts:
- Remove the http protocol from images
- Broken urls with http site and https wp-admin
- How to make my site use HTTPS for images or how to insert images as relative paths?
- HTTP error when uploading an image
- get_post_gallery_images returns thumbs . I want full size
- Media Upload Folder – how to manage
- Remove P tags from images
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Upload multiple images in a custom metabox
- How can I hide media library images from general users?
- WordPress speed slow after .5 million single image post via wp-cli
- How to add php to theme to show alt attributes
- Why won’t these imported images show up?
- Remove rel=”attachment wp-att-XX”
- Using Taxonomy Image code with my get_categories code
- Generate image size, based on the image-orientation
- Rename image during upload using date and time stamp?
- How to Add extra option to Image Block Settings?
- Upload thousands of images to WordPress without plugin?
- Images in the Twenty Fourteen theme
- Get author ID with attachment ID
- Automatically replace original uploaded image with large image size
- Problem with loading images from child theme CSS file with relevant path
- Custom image sizes without add_image_size()
- Watermark images only for some users
- Domain Change with New Image Sizes
- Why no images on a fresh WordPress installation?
- How to upload images in a specific folder using API
- AJAX – save an $_FILES picture in media library
- How to stop thumbnail generation from some images and different size thumbnail generate
- wordpress (woocommerce) add image to media library programmatically python
- Searching for any images in media library displays “no media found”
- How can I filter image HTML to add schema.org attributes?
- How to get file URL from media library
- How to implement secure frontend image upload? [closed]
- Change media URL (images)
- Resize header image
- Problem with images when no dimension in the URL [closed]
- some images not appearing on the website after migration [closed]
- WP 5.3 Removing Default WordPress Image Sizes
- How do I get my main image to stretch the full length of the screen?
- WordPress images not cropping properly
- HowTo: develop WP template with dynamic background image
- Clicks registering on Preview DNS site
- A little confused as to what add image size actually does
- Get thumbnail URL :)
- What did I do WRONG?
- Add retina “2x” in attribute “srcset”
- Large image not showing dimensions in Media Library
- Change logo image condition based on url
- How to insert image path in database to display product image in wp-admin?
- Hiding Media Source Links
- How to create a title images for different posts?
- resize and crop thumbnail photos
- How can I externally retrieve a post’s custom sized image
- Why is my table background image not showing in wordpress?
- WordPress Media Library – how to “uncache” images
- View photo album without having to scroll down for each picture
- Is there a way to add a featured image to an image/file attachment page?
- Media Library Cleanup A Thought Exercise
- Save media files (images) to database instead of the filesystem
- WordPress Multisite: Images moved to /sites/1?
- Site only working in browser where I created it
- After migration, all featured images using accentued characters in their file names are displayed “blanked”
- Adding numbers to an image based on co-ordinates
- A query to substitute images paths in gutenberg (website migration)?
- link not working in image section
- Images missing from Blog post page
- Page size too big due to images
- WP Large Images crash page
- Run function before uploaded image is saved
- Are WP images responsive by default?
- Prevent WordPress from creating individual size images
- wordpress images not showing properly
- Keep the original ratio in a thumbnail image
- What is the best way to handle Ajax image upload on front end?
- variable crop option with add_image_size()
- Why doesn’t WordPress make thumbnails for videos?
- Plain image uploading – no links, no classes, no sizes
- Thumbnail gallery by date and taxonomy
- How do I get resized thumbnails?
- How do I embed an image at actual size?
- Display ajax preloader for large images within posts
- Insert image doesn’t pickup right size
- Storing images on a local site
- Images will not attach to posts after site migration
- Tried everything but Facebook share button won’t load the post thumbnail
- Set image dimension for WP_Customize_Image_Control images
- Stop underlining image links
- How to get attached image alt text in media.php?
- Why some images are not allowed to be edited only for thumbnails?
- problems with alt text not appearing in source code
- 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]
- Gutenberg block HTML image rendering override
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions