wp_img_tag_add_decoding_attr ( $image, $context )

  • (string) image The HTML `img` tag where the attribute should be added.
  • (string) context Additional context to pass to the filters.
  • (string) Converted `img` tag with `decoding` attribute added.
Defined at:


Adds `decoding` attribute to an `img` HTML tag.The `decoding` attribute allows developers to indicate whether the browser can decode the image off the main thread (`async`), on the main thread (`sync`) or as determined by the browser (`auto`). By default WordPress adds `decoding="async"` to images but developers can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this to remove the attribute or set it to another accepted value.

Related Functions

wp_img_tag_add_loading_attr, wp_iframe_tag_add_loading_attr, wp_img_tag_add_width_and_height_attr, wp_img_tag_add_loading_optimization_attrs, wp_img_tag_add_srcset_and_sizes_attr

Top Google Results

User discussions

wpseek mobile