iaff_custom_attribute_tags

Filter the custom attribute tags of Image Attributes Pro. This filter can be used to add or remove custom attribute tags.

Default List Of Tags Available To Generate A Custom Image Attribute
Default list of tags available to generate a custom image attribute.

New tags can be added using this filter and it’s functionality can be defined using the iaffpro_get_custom_attribute_tag_{%tagname%}() function.

/**
 * Filter the custom attribute tags. 

 * 
 * Used by Image Attributes Pro to add custom tags like %yoastfocuskw% 
 * and %rankmathfocuskw% dynamically. 
 * 
 * @since 3.1
 * 
 * @param $available_tags (array) Array containing all custom attribute tags.
 */
return apply_filters( 'iaff_custom_attribute_tags', $available_tags );

Example Usage

Image Attributes Pro version 3.0 and above uses this filter to add the attribute tag for Yoast Focus Keyword when Yoast plugin is installed and active.

/**
 * Add custom attribute tag %yoastfocuskw%
 * 
 * @since 3.0
 * 
 * @param $available_tags (array) Array containing all custom attribute tags.
 * 
 * @return $available_tags (array) Array with yoastfocuskw added to the custom attribute tags. 
 */
function iaffpro_add_custom_attribute_tag_yoastfocuskw( $available_tags ) {

	$available_tags[ 'yoastfocuskw' ] = __( 'Yoast Focus Keyword', 'auto-image-attributes-pro' );

	return $available_tags;

}
add_filter( 'iaff_custom_attribute_tags', 'iaffpro_add_custom_attribute_tag_yoastfocuskw' );
Was this article helpful?
Yes, thanks! 👍Not really 👎