Automated Featured Image
The Automatic Featured Image plugin allows you to easily set a featured image for your posts even if one was not manually set. The plugin will automatically select the first image found in the post's content to be used as the featured image. This saves you time and ensures that all of your posts have a visually appealing featured image.
by cLonata · github.com/clonata/automated-featured-image · website
★ 2stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/clonata/automated-featured-image/archive/refs/heads/master.zipDeclares an update source (https://www.github.com/cLonata/automated-featured-image), so updates arrive through the plugin's own updater.
From the readme
Auto Featured Images for WordPress
A simple and straightforward solution to handle featured images for posts in WordPress. This code defines two functions that work as filters to ensure that all posts have a featured image.
Function 1: afifakethumbnailid
This function creates a fake thumbnail ID for posts that do not have a featured image set. This helps to bypass any placeholders that may be set up in the theme.
Function 2: afiautothumbnails
This function automatically sets a featured image for posts that do not have one set. It searches the content of the post for images and uses the first one it finds as the featured image.
Integration with WordPress
The code uses the WordPress addfilter function to attach these functions to the postthumbnailid and postthumbnailurl filters, respectively.
Usage
Simply copy the code into your WordPress theme's functions.php file or into a custom plugin and activate it. No further configuration is required, the code will take care of the rest.
Contribution
Feel free to contribute to this project by submitting bug reports, suggesting new features, or by creating pull requests.
License
The Automated Featured Image is licensed under the BSD-3 l