Set a Custom Class For the Linked Image

Code

Filename: gpml-set-custom-class-for-linked-image.php

<?php
/**
 * Gravity Perks // Media Library // Set a Custom Class For the Linked Image
 * https://gravitywiz.com/documentation/gravity-forms-media-library/
 */
add_filter( 'gpml_image_merge_tag_link_atts', function( $link_atts ) {
	// Update "custom-class" to your preferred class name.
	$link_atts['class'] = 'custom-class';
	return $link_atts;
}, 10, 3);

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.