Warning: This function has been deprecated. Use wp_image_add_srcset_and_sizes() instead.

wp_make_content_images_responsive() WordPress Function

The wp_make_content_images_responsive() function was introduced in WordPress 4.4. It allows for content images to be automatically scaled for a responsive design. This is a useful function for WordPress sites that need to be viewable on a variety of devices.

wp_make_content_images_responsive( string $content ) #

Filters ‘img’ elements in post content to add ‘srcset’ and ‘sizes’ attributes.


Description

Top ↑

See also


Top ↑

Parameters

$content

(string)(Required)The raw post content to be filtered.


Top ↑

Return

(string) Converted content with 'srcset' and 'sizes' attributes added to images.


Top ↑

Source

File: wp-includes/deprecated.php

function wp_make_content_images_responsive( $content ) {
	_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );

	// This will also add the `loading` attribute to `img` tags, if enabled.
	return wp_filter_content_tags( $content );
}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0This function has been deprecated. Use wp_image_add_srcset_and_sizes() instead.
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More