Set Same Description For Every WordPress Image Automatically

A common question from SEO’s is whether Image Attributes Pro can set the image description to a pre-defined value for every image.

The answer is YES! With Image Attributes Pro you can set the image description to anything you want not just for new uploads, but also for existing images.

Define Default Description For Every Image

To do this, we take advantage of the iaffpro_image_attributes WordPress filter.

If you are not familiar with using WordPress filters, don’t worry. Everything you need is included in this guide.

Example Code

The following code does the magic.

  • Copy paste it into the functions.php of your current theme.
  • Edit Your Custom Description Here to whatever you want.
  • Now when you upload an image, the description will be automatically set to whatever you added in the code.
  • To update existing images, run the bulk updater now. Make sure Bulk Updater Settings > General Settings > Update Image Description is checked.
/**
 * Modify image description generated by Image Attributes Pro
 *
 * @param $attributes 		(array) Associative array of image attributes.
 * @param $image_id 		(int) ID of the current image.
 * @param $parent_post_id	(int) ID of the post the image is inserted into. 0 for images not attached to a post.
 * 
 * @author Arun Basil Lal
 * @link https://imageattributespro.com/codex/iaffpro-image-attributes/‎
 */
 function prefix_iap_modify_image_attributes( $attributes, $image_id, $parent_post_id ) {
	
	$attributes['description'] = 'Your Custom Description Here';
	
	return $attributes;
}
add_filter( 'iaffpro_image_attributes', 'prefix_iap_modify_image_attributes', 10, 3 );

Result: Every Image Has The Same Description

Custom Description For All Images

Got questions? Please do not hesitate to get in touch.

Was this article helpful?
Yes, thanks! 👍Not really 👎