The issue I was having was with some conflicting code I had in my functions file (see below). I usually use this code to remove width/height attributes from being hard-coded into the element in the content area. Removing these somehow appears to mess up the new responsive image implementation in WordPress though. As soon as I removed this code, the responsive images appear to be working as expected.
Conflicting Code
// Remove Width & Height Attributes from Inserted Images
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
function remove_width_attribute( $html ) {
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
return $html;
}
Related Posts:
- How do I disable responsive images in WP 4.4?
- WP 4.4. responsive images browser choosing the “wrong” one
- How to insert pictures without hard coded dimensions?
- Making WordPress Gallery (.gallery-item) Responsive?
- WP 4.4 aspect ratio with responsive image
- How can I serve different images depending on screen size with wordpress
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- Responsive Images – Add srcset attributes to custom Images Function
- Get a list of all image sizes that match aspect ratio of original one
- How to exclude an image size from the WordPress srcset
- Featured image (responsive) above content is too small after update to WordPress 4.4
- How to display a different image size for mobile
- WP Responsive images – upload custom image sizes
- Fuzzy Images in WordPress 4.4
- Removing height and width from images with a caption
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- Multiple amp-image overlays. How to properly do this in wordpress?
- Fallback for missing srcset images
- max_srcset_image_width doesn’t work as intended
- Using SRCSET with Images and Featured Images
- Understanding WordPress image sizes and responsive images
- Custom responsive ‘featured image’ sizes
- One of my image sizes isn’t showing up in srcset
- How to stop WordPress from completely overriding my tags in my templates?
- Adding srcset to an image in ajax
- the_content not showing responsive image attributes srcset or sizes
- Serve different images per screen size and cache possible?
- Disable Media File Image Link On Mobile Devices
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- Why does WordPress list all image sizes in srcset even if they’re larger?
- Responsive header image
- What’s are some best practices for responsive images (e.g. for section headers)?
- WordPress Responsive Image ( srcset ) not work properly
- Responsive Images – Defining
- Decide how Hero image appears on mobile
- Responsive Featured Images Not Working
- Responsive images with srcset
- Getting extra image links in code with wp_get_attachment_image
- built-in responsive images in content – do I need to add anything to functions.php?
- Responsive images in Bootstrap 4 slider
- WordPress not choosing the right image from srcset
- Responsive Images in WordPress
- Is there a good way to use CMS images with CSS
- Remove one srcset entry from wp_get_attachment_image
- Generate / attach Image srcsets from ACF Image Field
- What’s the proper way to find and remove duplicate images from posts and the media library?
- get_post_gallery with Gutenberg
- Mixed content warnings after changing site adress from HTTP to HTTPS
- Insert an image into a post by API
- Creating a rotating header /image slider using theme customization
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- Double thumbnails?
- No srcset for hard-cropped thumbnails
- Slider image issue in wordpress
- Retrieving images from a NextGEN gallery
- Query for recent images across multiple posts
- A way to change image urls in post to cdn image url?
- What’s the proper way to use the get_image_tag filter?
- Get author custom image field URL to display on post page?
- Print specific image size in galley loop
- Image URLs stopped working due to Permalinks?
- How can I add a “data-pin-nopin” the featured image html?
- Hardcoded Images Too Big
- Image increasing kb on resize
- I have no images in an activated wp theme
- Image large size [closed]
- Media gallery images url instead of ID on WP API Response
- css to fit image by HEIGHT
- Some Images Disappeared from Media Library?
- Get an image from url, resize it, and save on a custom folder (not the media library)
- Get all custom sizes in srcset attribute
- Why isn’t add_image_size(‘event-secondary-image-thumbnail’, 250, 150) working?
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- How do I implement an image viewer and rotator? [closed]
- Upload images – Theme options
- Is it possible to modify default image name suffix?
- How to replace post image url before posting using api?
- Background Image Does Not Display on Page
- Can’t fix corrupted images
- WordPress Single Post image gallery as slider
- There is an image embedded on my page that I can’t locate in order to delete. Please help me!
- Could creation of various image sizes cause slow form submission response?
- Allow users to upload attachments to certain posts
- WordPress and Advanced Custom Fields and Flickity
- How to get image ID based on get_theme_mod image URL?
- How to bulk update then save images in wordpress posts
- stop wordpress from resizing feature gif images
- Change wordpress default upload path to another domain
- Modify media file markup output
- How can I add an “Attach image to this post/page” link on the Add Media lightbox?
- WordPress Is Saving Original Image Only
- Display images from JS?
- Create slider option in editor
- How to make an image bigger with wp_get_image_editor
- Assign one featured image to multiple posts?
- An image on my site is showing as the wrong image [closed]
- Set padding for all content except images and few more elements
- Orientation of featured image in post?
- WordPress Site Broken and it gives Headers Already sent error