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
6026      /*
6027       * Only apply the decoding attribute to images that have a src attribute that
6028       * starts with a double quote, ensuring escaped JSON is also excluded.
6029       */
6030      if ( ! str_contains( $image, ' src="' ) ) {
6031           return $image;
6032      }
6033
6034      /** This action is documented in wp-includes/media.php */
6035      $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
6036
6037      if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
6038           $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
6039      }
6040
6041      return $image;
6042 }
6043
6044 /**