wppaste
WordPress

apply_filters( 'wp_content_img_tag', string $filtered_image, string $context, int $attachment_id )

Since
6.0.0
Filters an img tag within the content for a given context.

Compatibility

WordPress
since 6.0.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$filtered_imagestring
Full img tag with attributes that will replace the source img tag.
$contextstring
Additional context, like the current filter name or the function name from where this was called.
$attachment_idint
The image attachment ID. May be 0 in case the image is not an attachment.

Where this hook fires · 1

  • wp-includes/media.php:2072wp_filter_content_tags()

Source code

			 * @since 6.0.0			 *			 * @param string $filtered_image Full img tag with attributes that will replace the source img tag.			 * @param string $context        Additional context, like the current filter name or the function name from where this was called.			 * @param int    $attachment_id  The image attachment ID. May be 0 in case the image is not an attachment.			 */			$filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id ); 			if ( $filtered_image !== $match[0] ) {				$content = str_replace( $match[0], $filtered_image, $content );			} 			/*

Changelog

Introduced in 6.0.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.