Modify the image HTML markup after the bulk updater has added the necessary attributes. <\/p>
\/**\n * Filter the image HTML markup. \n * \n * Useful to add custom image attributes or remove existing attributes.\n * Example: You can add Lazyload attributes or Pinterest attributes) on all images. \n * \n * @param $match[0] (string) The image HTML markup (<img alt=\"\" title=\"\" ...) without \n * the closing '>' after it is updated by Image Attributes Pro.\n * \n * @since 1.4\n *\/\nreturn apply_filters( 'iaffpro_html_image_markup_post_update', $match[0] );<\/code><\/pre>
$match[0]<\/code> contains the image markup without the closing ‘>’ tag. <\/p>
For example:<\/strong><\/p>
<img title=\"Image Title\" src=\"https:\/\/imageattributespro.com\/wp-content\/uploads\/2021\/05\/custom-filter-and-regex-filter-image-attributes-pro-result.png\" alt=\"Image Alt text\" class=\"wp-image-99\"\/<\/code><\/pre>
Note<\/strong>: This filter is triggered only when the bulk updater updates the images within the post or product HTML. Be sure to select the appropriate Bulk Updater Behaviour<\/code> in the Bulk Updater Settings<\/code> tab. <\/p><\/figure>
Example Usage<\/h2>
An example of using the filter to add a custom data-origin=\"Your Name\"<\/code> to each image. Add this to the functions.php<\/code> of the active theme.<\/p>
\/**\n * Add custom data-origin attribute to every image. \n * \n * @param $match (string) The image HTML markup after the bulk updater \n * has added the necessary attributes.\n * \n * @author Arun Basil Lal\n * @link https:\/\/imageattributespro.com\/codex\/iaffpro_html_image_markup_post_update\/\n *\/\nfunction prefix_iap_add_data_origin_to_images( $match ) {\n\t\n\t\/\/ Replace '<img' with '<img data-origin=\"Your Name\"'\n\t$match = str_replace( '<img', '<img data-origin=\"Your Name\"', $match );\n\t\n\treturn $match;\n}\nadd_filter( 'iaffpro_html_image_markup_post_update', 'prefix_iap_add_data_origin_to_images' );<\/code><\/pre>