How To Automatically Set The Featured Image In WordPress

How To Require A Featured Image In Post Before Publishing In WordPress

Having at least one image in your post in really good for search engine optimization, but it’s hard to get this thing in the mind of your authors and contributors. Here’s a snippet which would require a featured image in post before publishing it to your WordPress. An easy way to ensure all posts have a featured image.

When you try and publish a post without a featured image, you will get following error message:

[alert style=”red”]You must select Featured Image. Your Post is saved but it can not be published.[/alert]

Just drop the following snippet to your current theme’s functions.php file: