Skip to content

Core AI: Improve AI Generated Image Naming for Featured Images (Include AI Prefix + Context) (WP 7.0 RC) #402

@kishan-ranawat

Description

@kishan-ranawat

Currently, when a featured image is generated using the AI image generation feature, the image is saved with a default filename in the format:

ai-generated-image-<timestamp>
Image Image

This naming approach lacks context and does not provide meaningful information about the image content.

Problem

  • Filenames are not descriptive or SEO-friendly
  • Difficult to identify images in the media library
  • No indication of image context/content

Expected Behavior

Generated images should include:

  1. A consistent prefix to indicate AI origin
  2. A descriptive, human-readable context (based on post title or content)
  3. A timestamp (or unique identifier) for uniqueness

Proposed Filename Format

ai-generated-image-<context>-<timestamp>.jpg

Examples

Post Title: "10 Tips to Improve Email Marketing"

ai-generated-image-email-marketing-tips-1712674832.jpg

Post Title: "WordPress SEO Guide"

ai-generated-image-wordpress-seo-guide-1712674832.png

Proposed Solution

  • Extract context from:

    • Post title (preferred), or
    • Key phrases from content
  • Convert context into a slug:

    • Lowercase
    • Hyphen-separated
    • Remove special characters
  • Prefix filename with ai-generated-image-

  • Append timestamp or unique hash for collision avoidance

  • Ensure compatibility with WordPress media handling

Additional Enhancements

  • Allow developers to modify filename via a filter/hook

  • Limit context length (e.g., 5–8 words) to avoid overly long filenames

  • Ensure fallback to:

    ai-generated-image-<timestamp>
    

    if context extraction fails

Acceptance Criteria

  • Filenames follow ai-generated-image-<context>-<timestamp> format
  • Context is derived from post title or content
  • Filenames are sanitized and SEO-friendly
  • AI-generated origin is clearly identifiable
  • No breaking changes to existing functionality
  • Developers can customize via filter/hook

Impact

  • Improves media library organization
  • Enhances SEO and readability of filenames
  • Clearly distinguishes AI-generated images from other uploads
  • Provides better context for users and developers

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Enhancement.

    Projects

    Status

    To do

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions