Created
September 8, 2022 18:02
-
-
Save arunbasillal/924868debc1c601d2e7773ca68aad341 to your computer and use it in GitHub Desktop.
Add hyphens between words for Image Title in Image Attributes Pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add hyphens between words for Image Title in Image Attributes Pro | |
* | |
* @param $attributes (array) Associative array of image attributes. | |
* | |
* @author Arun Basil Lal | |
* @link https://imageattributespro.com/codex/iaffpro_image_attributes/ | |
*/ | |
function prefix_iap_add_hyphens_to_image_title( $attributes ) { | |
$attributes['title'] = trim ( $attributes['title'] ); | |
$attributes['title'] = str_replace( ' ', '-', $attributes['title'] ); | |
return $attributes; | |
} | |
add_filter( 'iaffpro_image_attributes', 'prefix_iap_add_hyphens_to_image_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment