Black Friday 40% off yearly and lifetime plans · 18d left Ends in 18d09h21m Claim 40% off
Core42 docs

How to Use Auto Featured Image in WordPress

Auto Featured Image in Classic Monks automatically sets the first image in post content as the featured image when saving. Ensures every post has a featured image.

By Founder & Lead Developer

Last updated

3 minutes

Key takeaways

  • Sets the first image as featured on save when no featured image exists
  • Works with the classic editor, Gutenberg image blocks, and galleries
  • Does not overwrite an existing featured image
  • Does not pick up background images, embeds, or JavaScript-rendered images
  • Saves the original as a media library attachment if it isn’t already

Why You Need It

Featured images are essential for WordPress sites:

  • Social sharing (Open Graph and Twitter Cards use the featured image)
  • Archive pages (most themes show featured images in post lists)
  • SEO (Google Images search can surface featured images)
  • Reader experience (posts with images get more engagement)

But authors forget to set them. Auto Featured Image is the safety net: every post that has an image in its content automatically gets a featured image, even if the author skipped the manual step.

Configuration Options

Option Description Default
Auto Featured Image Master toggle. Enables the auto-set behavior. Off

No nested options. The feature runs silently on every post save.

What Image Sources Are Supported

Image Source Supported? Notes
Image uploaded to Media Library, embedded in content Yes Uses the existing media library attachment
Image embedded in content via Gutenberg Image block Yes The block’s <img> is captured
Image embedded in content via classic editor Yes Standard <img> tags are captured
Image in a Gallery block Yes The first gallery image is used
Image from an external URL (not in Media Library) Yes The image is downloaded and added to the Media Library
Featured image set manually N/A The existing featured image is preserved (not overwritten)
Image in a Cover block (Gutenberg) Yes The cover image is used
Image as a CSS background No Auto Featured Image only reads <img> tags
Image rendered by JavaScript (e.g., lazy-load placeholder) Partial The initial <img> is captured; JS-replaced images are not
Image inside a third-party embed (YouTube, etc.) No Embeds don’t have a usable featured image

Developer Notes

Auto Featured Image sets the first image in post content as the featured image. No developer hooks are currently exposed.

Options used:

Option Type Default
enable_auto_featured_image Boolean false

Troubleshooting

4 problems and how to fix each one.

The featured image is not being set automatically

Cause: The post has no <img> tag in its content, the first image is a background image (not supported), or the post already has a featured image set.
Fix: Verify the post has a real <img> tag by editing in the Text/Code view. Manually delete the existing featured image (if any) and save again to trigger the auto-set.

The auto-set image is the wrong one

Cause: The “first” image is interpreted as the first <img> in the rendered content. This may be a small icon, a logo, or a decorative image that appears before the main content image.
Fix: Use the cm_auto_featured_image_selector filter to apply custom selection logic (e.g., skip images smaller than 200×200, prefer images in the post body over images in sidebars). Or manually set the featured image for posts where the auto-set picks the wrong one.

The auto-set image has no alt text

Cause: The original image had no alt text, and the feature doesn’t auto-generate one.
Fix: Use the cm_auto_featured_image_alt filter to set alt text from the post title or a default. Or manually add alt text to the media library image (which the feature will pick up).

The image is being added to Media Library every save

Cause: If the post content has an external image URL, the feature downloads it and adds it to the Media Library on every save. This creates duplicate media library entries.
Fix: Move external images to the Media Library manually before publishing. The feature will then use the existing media attachment, not create a new one.

Was this doc helpful?

Your answer tells us which docs to fix first.

Still stuck? Ask on the forum or email help@classicmonks.com.
Joy Chetry
Written by the person who built it

Joy Chetry

Founder & Lead Developer, Classic Monks

Joy is the founder of Classic Monks and GoodMonks Solutions, a web development agency that builds WordPress and WooCommerce sites for clients. Classic Monks grew out of the agency's own need to consolidate 20 to 30 separate plugins into one core stack.

Follow this doc on a real site.

Open a private WordPress site with Classic Monks, WooCommerce and Bricks Builder installed, and follow this doc step by step. Free for 24 hours, no card.

280 docs, written by Joy Chetry 15 day refund window