Created
November 8, 2025 09:26
-
-
Save arunbasillal/566dd144625ce9dbc7fbd2b22e53e102 to your computer and use it in GitHub Desktop.
IAP: Preserve triple hyphens while generating image attributes.
This file contains hidden or 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
| /** | |
| * Preserve triple hyphens while generating image attributes. | |
| * | |
| * Replace triple hyphens in image (---) with a placeholder (IAPHYPHEN) in the image filename. | |
| * Image Attributes Pro already replaces IAPHYPHEN back to a single hyphen ( - ) after applying filters | |
| * in iaffpro_image_name_from_filename(). | |
| * | |
| * @param $image_name (string) Name of the image. | |
| * @return $image_name (string) Name of the image with triple hyphens replaced by IAPHYPHEN | |
| * | |
| * @author Arun Basil Lal | |
| * @link https://imageattributespro.com/codex/iaffpro_image_name_from_filename_pre/ | |
| */ | |
| function prefix_iap_preserve_triple_hyphens( $image_name ) { | |
| return str_replace( '---', 'IAPHYPHEN', $image_name ); // Adds a placeholder. | |
| } | |
| add_filter( 'iaffpro_image_name_from_filename_pre', 'prefix_iap_preserve_triple_hyphens' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment