Title: wp_content_img_tag
Published: May 25, 2022
Last modified: May 20, 2026

---

# apply_filters( ‘wp_content_img_tag’, string $filtered_image, string $context, int $attachment_id )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#parameters)󠁿

 `$filtered_image`string

Full img tag with attributes that will replace the source img tag.

`$context`string

Additional context, like the current filter name or the function name from where
this was called.

`$attachment_id`int

The image attachment ID. May be 0 in case the image is not an attachment.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#source)󠁿

    ```php
    $filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/media.php#L1971)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/media.php#L1971-L1971)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_filter_content_tags()](https://developer.wordpress.org/reference/functions/wp_filter_content_tags/)`wp-includes/media.php` |

Filters specific tags in post content and modifies their markup.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_content_img_tag/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_content_img_tag%2F)
before being able to contribute a note or feedback.