Here is a related question that should answer yours. Basicly you want to use the pre_comment_on_post
hook
function custom_validate_comment() {
//validate for brief and rating
if( empty( $_POST['brief']) || empty( $_POST['rating']) )
wp_die( __('Error: you must fill in both the rating and the brief') );
//make comment not required
if(empy($_POST['comment']){$_POST['comment'] == "empty_comment";}
}
add_action('pre_comment_on_post', 'custom_validate_comment');
function custom_change_comment( $commentdata ) {
if( $commentdata['comment'] == 'empty_comment' )
$commentdata['comment'] = '';
return $commentdata;
}
add_filter('preprocess_comment', 'custom_change_comment');
That should at least get you on the right track
Related Posts:
- Adding another state (spam, reject, approve) to wordpress comments?
- Semi-Private Comments + page comments -> is it possible?
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Add validation and error handling when saving custom fields?
- Validating Custom Meta Box Values & Required Fields
- don’t publish custom post type post if a meta data field isn’t valid
- Is there a way to set default custom fields when creating a post?
- Show only posts which can be commented OR have custom meta field
- Add custom objects/entities to WordPress
- Show Custom Comment Fields when editing in admin
- Edit Custom Database Tables in WordPress
- Correct Approach for Validating Custom Field Input
- Filter results with custom field values and dropdown
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Is there a way to do multiple ordering on a multiple meta_query?
- Check before publishing, if already exist post with current custom field value
- How to customize default wordpress editor?
- How to reload the role specific registration form on validation errors?
- Problem in custom meta boxes
- Comments form custom fields order
- How to show custom field’s value under post/page title in wp-admin
- Multiplile values checkbox or select in custom meta box
- Adding Properties to User Profile and Displaying in List
- ajax delete value from custom field array
- How do I read the value of a custom field of the page?
- how to save multiple custom fields for a post in one go?
- get_post_meta in sitewide tags plugin fails to return value for custom fields
- How to add a title field in comments?
- Insert attachment ID in custom field from media uploader
- How do you create dynamic customised sections in WordPress?
- Delete all custom fields at once?
- How to validate custom field on lost password form before the user id field?
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- Better Method for Multiple Meta Boxes
- Validate data on attachment_fields_to_save
- query usermeta from custom field
- custom avatar removal
- Displaying a checkbox array from advanced custom field
- WP 3.1 meta_query for multiple custom field values
- How to select posts from multiple categories and metavalues?
- Sort custom field by post
- Send email with custom fields after new draft is saved or new post published
- displaying and sorting comments by a custom field (using PODS plugin) [closed]
- Declaring in variables [closed]
- How do i add custom fields to my themes template file?
- Custom tables or custom fields?
- Post selector as Custom Field
- don’t publish custom post type post if a meta data field isn’t valid
- Warn user that data may be lost for custom pages
- How to remove custom fields from the selector?
- comment meta_query for keys that aren’t yet set
- Check & remove special characters in a field?
- Let’s Create Custom Field Template Documentation
- How can I combine this php statement to get the results of multiple variable inputs?
- How to add fields in custom registration form, validate it and aave to db? [closed]
- Is there a way to set default custom fields when creating a new post?
- MetaBox not saving after empty
- Showing Custom Fields on Parent Page
- How to validation for sanitize_URL?
- How can I output the custom fields wrapping with HTML
- Custom meta boxes not saving
- How to get all custom fields with some prefix in key?
- Best way to achieve multiple links in a post title
- custom comment_form fields not displaying
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Editing custom fields for comments
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Save custom field types with this function…?
- Custom field bug in WordPress 3.2
- How to sort post listing on a page using custom field value?
- Adding re-type email and check it if the email match
- Odd functions.php issue in WordPress
- Counting post fields
- comments_where Hook
- Rewrite comment form post ID on submit
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Save input form on custom field
- How to format the various types of custom fields?
- Echo out custom fields in comments
- Delete custom fields on post publish?
- When post is updated, custom metadata in text area field is overwritten
- Adding custom fields to images
- Is it possible in WordPress
- custom field functionality
- Custom fields are not displaying in page with multiple loops
- How to add an option to admin to add image that could be used as header?
- Show or hide lang=”ur” in main element
- Using Hooks. Thematic
- Adding thumbnails for non-image attachments
- Custom field in a shortcode?
- How to add a prefix to existing custom fields over MYSQL query?
- I would like to display different text on different pages
- Add image custom attribute [closed]
- Check if a field is capitalized?
- How I can change PayPal IPN ‘custom’ field in woocommerce?
- Problem display
- Google not index my Custom 404 page ?why?
- Add fields to edit in custom widget
- How to add a custom field to the comments “Quick Edit” screen?