Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_content_img_tag

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1855                /**
1856                 * Filters an img tag within the content for a given context.
1857                 *
1858                 * @since 6.0.0
1859                 *
1860                 * @param string $filtered_image Full img tag with attributes that will replace the source img tag.
1861                 * @param string $context        Additional context, like the current filter name or the function name from where this was called.
1862                 * @param int    $attachment_id  The image attachment ID. May be 0 in case the image is not an attachment.
1863                 */
1864                $filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id );
1865
1866                if ( $filtered_image !== $match[0] ) {
1867                     $content = str_replace( $match[0], $filtered_image, $content );
1868                }
1869
1870                /*
1871                 * Unset image lookup to not run the same logic again unnecessarily if the same image tag is used more than
1872                 * once in the same blob of content.
1873                 */