Filtering the title attribute of an image (Pro Feature)

Need help with this?
Purchase All in One SEO Pack Pro to get dedicated support from us.

Buy Now

The aioseop_image_seo_title filter hook.


$title = apply_filters( 'aioseop_image_seo_title', $this->get_attribute( 'title', $image_id ), $image_id );

This filter can be used to filter the title attribute of images.

Parameters (2)

0. $value (string)
the value of the title attribute.
1. $image_id (int)
the ID of the image.


The code example below can be used to change the title attribute for a given post with ID 1:

add_filter( 'aioseop_image_seo_title', 'my_change_image_title', 10, 2 );

function my_change_image_title( $value, $image_id ) {
	if( 1 === $image_id ) {
		return 'This is the filtered title attribute.';
	return $value;

Defined (1)

The filter is defined in the following location(s).

pro/class-aioseop-image-seo.php (2 occurrences)

For instructions on how to use this code, please refer to our FAQ here.

  • Was this helpful ?
  • YesNo