I have customised my WordPress site design to use the featured image for posts quite excessively. This is why I need to require all post made by non-admins to require a set featured image.
How is this possible?
I have customised my WordPress site design to use the featured image for posts quite excessively. This is why I need to require all post made by non-admins to require a set featured image.
How is this possible?
You must be logged in to post a comment.
You need to hook the Publish Action in a custom PlugIn you write. Although this is to require a title, this should get you started, you just need to check if a featured image was assigned.
Look at (
has_post_thumbnail( $post->ID )
) to determine if a post has a featured image.Given Gary’s example above, I’ve written the following to my functions.php file:
I’d much rather see this in a plugin as well – there’s one called Mandatory Field but it doesn’t work with scheduled posts. Both are not really eloquent solutions.
you can use a plugin
or you can copy and paste below code in your wordpress theme functions.php file: