How To Automatically Set The Featured Image In WordPress

How To Automatically Set The Featured Image In WordPress

WordPress has a featured image option which allows the author to pick the post thumbnail of the post. Your featured post will be used on your theme, feed and various places. Every major blogging platform has this feature in it but with WordPress, you can take it to the next level.

If you don’t like manually picking featured image for every single post of your blog, then you can automatically set the featured image of the post. This snippet from WPForce will automatically set the first image of your as the featured image. If there’s no images in the entire post, then it has an option to set a default featured image.

Add following snippet to your functions.php file:

Replace 414 in the 11th line of the above code from the attachment id of your default image.