Skip to content

Instantly share code, notes, and snippets.

@arunbasillal
Last active April 24, 2023 07:17
Show Gist options
  • Save arunbasillal/04eb9c2a7606ac2839135ccdc8647a28 to your computer and use it in GitHub Desktop.
Save arunbasillal/04eb9c2a7606ac2839135ccdc8647a28 to your computer and use it in GitHub Desktop.
Custom tag %post_slug% for Image Attributes Pro
/**
* Custom tag %post_slug% for Image Attributes Pro
*
* @param $image_id The ID of the image that is being updated.
* @param $parent_post_id The post to which the image is attached (uploaded) to.
* @param $args (array) An array containing additional arguments.
*
* @return string Slug of the post where the image is uploaded to.
*
* @refer https://imageattributespro.com/codex/iaffpro_get_custom_attribute_tag_tagname/
*/
function iaffpro_get_custom_attribute_tag_post_slug( $image_id, $parent_post_id, $args = array() ) {
return basename( get_permalink( $parent_post_id ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment