Parsed: 131717

function wp_img_tag_add_decoding_attr( $image, $context ) {
  // Only apply the decoding attribute to images that have a src attribute that
  // starts with a double quote, ensuring escaped JSON is also excluded.
  if ( false === strpos( $image, ' src="' ) ) {
    return $image;
  }

  
/**
 * Filters the `decoding` attribute value to add to an image. Default `async`.
 *
 * Returning a falsey value will omit the attribute.
 *
 * @since 6.1.0
 *
 * @param string|false|null $value   The `decoding` attribute value. Returning a falsey value
 *                                   will result in the attribute being omitted for the image.
 *                                   Otherwise, it may be: 'async' (default), 'sync', or 'auto'.
 * @param string            $image   The HTML `img` tag to be filtered.
 * @param string            $context Additional context about how the function was called
 *                                   or where the img tag is.
 */
  $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );

  if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
    $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
  }

  return $image;
}