Required Post Fields helps you ensure that your users & authors don’t publish content by mistake if they forget to do something. It’s common to require content to have a featured image, be categorised or tagged, or to need a custom excerpt. This plugin makes sure that happens.

It adds settings to your admin area to let you make certain post fields required. You can force authors to upload a thumbnail and even set a minimum required image size for it, as well as the ability to require a title, content, custom excerpt, tags and a non default category.

The plugin fully supports any custom post types out of the box and you can also add as many extra validation rules as you like using the plugin’s API!

UsageUpload and activate the plugin. Head to the Writing settings page and scroll to the bottom. There you will find boxes to check to make certain fields required when a user adds or edits a post or page.

The default options are.

- Require title

- Require content

- Require custom excerpt

- Require non default category

- Require tags

- Require featured image

- Minimum size for featured images

When you add or edit a post and it doesn’t meet the requirements the relevant fields will be highlighted.

APIFor the developers among you (or those brave enough to add a few lines of PHP) there is an API to add/remove your own required fields too, even for custom fields.

add_action('admin_init', 'my_required_fields');function my_required_fields() {// adds a basic check to see if $_POST[ 'custom_meta_field' ]// is empty or notregister_required_field( 'custom_meta_field', 'You must fill out the custom meta field' );}

Adding options to the settings screenThere are plenty of hooks available to modify the behaviour of this plugin. One such hook allows you to extend the writing settings available to administrators in the settings.

The following is an example of adding an option to require a page template to be set for pages.

Highlighting fields with an errorIn the above example you should note that the highlight option contains a CSS selector targeting the error field.

If you do this the plugin will highlight the field or section that matches the selectors. Clicking on the error message will scroll the page to the field that has an error and shake it to make it clear what needs to be actioned.

Thanks!We’re happy to answer any support questions and provide code examples to achieve what you want with the plugin’s API in the comments.