Skip to content

Image SEO: Automatic ALT and Title Attributes

Image SEO automatically adds missing ALT and title attributes to images on your site. This improves accessibility and SEO without requiring you to manually edit every image. The feature generates attributes on-the-fly when content is rendered, so your original image data remains unchanged.

Go to SEOvault AI > General > Image SEO. The settings include:

  • Enable Image SEO: Toggle to turn automatic attribute generation on or off
  • ALT Attribute Format: Template string for generating ALT text
  • Title Attribute Format: Template string for generating title attributes
  • Override Empty ALT: Whether to replace existing empty ALT attributes

When Image SEO is enabled, SEOvault AI filters your post content and featured images before they render. It scans for <img> tags and adds missing ALT and title attributes based on your format strings.

Key points:

  • Attributes are generated at render time, not stored in the database
  • Only empty attributes are filled—existing ALT or title values are never overwritten
  • The feature works with post content, featured images, and WooCommerce product galleries
  • Lazy-loaded images and responsive images are supported

The ALT attribute format defines how ALT text is generated for images without existing ALT text. Use replace variables to create dynamic ALT text.

Default format:

%filename%

Common formats:

%title% - %filename%
%category% %filename%
%filename% on %sitename%

The %filename% variable extracts the image filename, converts dashes and underscores to spaces, and capitalizes the first letter of each word. For example, coffee-cup-hero.jpg becomes Coffee Cup Hero.

The title attribute format works the same way as ALT format but for the title attribute. Title attributes appear as tooltips when users hover over images in some browsers.

Default format:

%title%

Common formats:

%title% - %sitename%
%filename% - %category%

Leave the title format empty if you don’t want automatic title attributes generated.

The Override Empty ALT option controls how existing empty ALT attributes are handled:

  • Enabled (default): Replaces alt="" with generated ALT text
  • Disabled: Leaves alt="" unchanged, only adds ALT when the attribute is completely missing

This matters because some themes or plugins add empty ALT attributes to images. Enable this option to fill those empty attributes with meaningful text.

Use the same replace variables available in SEO title and description templates:

Variable Description Example
%filename% Image filename converted to readable text Coffee Cup Hero
%title% Post title Best Coffee Tips
%sitename% Site name Joe's Coffee Shop
%sitedesc% Site tagline Best coffee since 2010
%sep% Title separator -
%category% First post category Guides
%tag% First post tag brewing
%excerpt% Post excerpt Learn the best tips...
%date% Publication date January 15, 2025

The %filename% variable is unique to Image SEO and extracts the image filename from the src, data-src, or data-ct-lazy attribute.

Image SEO works with WooCommerce product images and galleries:

  • Product featured images: Uses the product title or filename for ALT text
  • Product galleries: Applies ALT text to gallery images using filename-based text
  • WooCommerce blocks: Filters wp_get_attachment_image_attributes to catch block-rendered images

For WooCommerce products, when the stored attachment ALT is empty, the feature uses the image filename instead of the product title. This prevents all product images from having identical ALT text.

Image SEO processes images in these locations:

  • Post content: Images embedded in the post body
  • Featured images: The post thumbnail
  • WooCommerce galleries: Product gallery images and thumbnails
  • WordPress functions: Images generated by wp_get_attachment_image()

Images in widgets, sidebars, or custom theme areas may not be processed unless they pass through the the_content or post_thumbnail_html filters.

The feature skips images in these cases:

  • Image SEO is disabled in settings
  • Both ALT and title format strings are empty
  • The image already has a non-empty ALT or title attribute
  • The image is in a script or style tag (excluded from processing)
  • The image has no valid source attribute (src, data-src, or data-ct-lazy)

The %filename% variable processes image filenames to create readable text:

  1. Extracts the filename from the URL or path
  2. Removes the file extension
  3. Converts dashes, underscores, and plus signs to spaces
  4. Trims whitespace
  5. Capitalizes the first letter of each word (title case)

Examples:

  • my-coffee-shop-hero.jpgMy Coffee Shop Hero
  • product_image_001.pngProduct Image 001
  • best-coffee-tips-ever.webpBest Coffee Tips Ever

Image SEO processes content on each page load, but the impact is minimal:

  • Only processes images when the feature is enabled
  • Skips images that already have attributes
  • Uses efficient regex parsing for HTML extraction
  • Caches nothing—attributes are generated fresh each request

For sites with very large posts (hundreds of images), consider disabling the feature if you notice performance issues.

  • No database changes: Attributes are generated at render time, so your media library remains unchanged
  • Manual ALT priority: If you manually set ALT text in the media library, that value is never overwritten
  • Lazy loading: Supports lazy-loaded images by checking data-src and data-ct-lazy attributes
  • External images: Works with external image URLs as long as they have valid filenames
  • Special characters: Filenames with special characters are handled by WordPress URL parsing
  • Web app priority: If web app image data is available, it takes priority over auto-generated ALT text