Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_img_tag_add_decoding_attr

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
6037      /*
6038       * Only apply the decoding attribute to images that have a src attribute that
6039       * starts with a double quote, ensuring escaped JSON is also excluded.
6040       */
6041      if ( ! str_contains( $image, ' src="' ) ) {
6042           return $image;
6043      }
6044
6045      /** This action is documented in wp-includes/media.php */
6046      $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
6047
6048      if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
6049           $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
6050      }
6051
6052      return $image;
6053 }
6054
6055 /**