If you use wp-comments-post.php
it would be better to customize comment_form by hook comment_form_default_fields
, I don’t know why you create the new one. But as per of your functions you can handle it like this
add_filter( 'preprocess_comment', 'verify_comment_meta_data', 1, 1 );
function verify_comment_meta_data( $commentdata )
{
$commentdata['review_title'] = ( ! empty ( $_POST['review_title'] ) ) ? sanitize_text_field( $_POST['review_title'] ) : false;
if ( ! $commentdata['review_title'] )
wp_die( __( '<strong>ERROR</strong>: please fill the required fields ( city ).', 'textdomain' ) );
return $commentdata;
}
Actuallly as WordPress comments workflow, the error messages could be handled by fire pre_comment_on_post
, check_comment_flood
, or pre_comment_approved
.
Related Posts:
- Is it possible to pull comments from facebook into your blog?
- Enable Submit Comment Without Page Reload (Using Ajax)?
- Getting Post Comments for post ID using WP_Query() and a Custom Loop?
- How to deal with small scale comment spam on small commercial sites? [closed]
- How to use a custom comments template
- Comment visibility
- Add placeholder attribute to comment form fields
- human_time_diff() returns “48 years ago” for all comments
- Allowing more elements in comments via functions.php
- Set post comments open function
- Allow anonymous comments, but prevent spam [closed]
- Where to remove from comment’s feed?
- Why are default comments deprecated?
- Comments Reply Form
- Delete all user comments
- Why do I get email notifications about comments that WordPress has already determined are spam?
- “Leave a comment” link even when you can’t
- How to check if commenter is the_author?
- Strategies for coping with hyperagressive spambots?
- Get number of comments per page
- WP comments form (custom) is displaying an extra comment field
- WordPress Comment. Need some details of wp_comments DB table
- Sanitizing comments or escaping comment_text()
- Custom disqus_identifier not properly changing default value
- Edit Comment_Field while using T5 Comment Textarea On Top-Plugin
- Registered but Anonymous comments
- How to import only certain comments from post[s]
- Make wordpress comments work with include templatepath
- How can I stop WP from automatically marking “Automatically close comments on articles older than 28 days”? [closed]
- Removing from Comment
- Callback function argument which is required for wp_list_comments ()
- The comment login form is visible to me but not to the user
- How to insert a comma to the child comment construction in function.php?
- Log file reports SQL Error processing child comments
- Editing WordPress comments : generating comment from selection
- how to properly use comments-template.php
- How can I assign a specific id to the last comment of a post
- Reply By Email to comment notifications
- Modify WordPress Comment From For AMP Html
- How to implement comments on specific fields in wordpress?
- delete duplicate comments
- wp_list_comments renders incorrectly nested
- Alternative to the filter comment_reply_link
- Number/ Position of a Comment
- code highiglight not working comment
- Comment number does not increment
- Cancel comment filter?
- WP confusing “links to my articles” with “comments”?
- How to check if a comment has replies?
- Can I have Comments open to specific users only?
- How to edit the text below “Leave a Reply”
- Commenting system for WordPress
- Commentlist: bypostauthor problem with children list
- Comments does not work?
- How do I disable the discussion notification emails to us when a comment is “approved” and when an adiministrator replies?
- Review count per product
- Moving post’s content to post’s comments section
- comment_notes_before not working
- why can’t I retrieve the comment ID?
- How to create post comment from different domain
- get_comment_link without pagination base in the returned URL?
- Comments on future posts
- Copy and Paste Password for Comments
- Display custom text when comments are closed
- Returning error upon comment being flagged as spam
- is it possible to have the full code instead in the comments.php page
- How do i remove approved spam comments by date?
- Remove Javascript generated by Comments
- How to Trigger comment_form_after action if comment_form() not used
- Need Comment Link Help
- Insert ads between comments
- get_query_var(‘paged’) for WP_Comment_Query always return 1 when using paginate_comments_links()
- How to only show current user’s comments and comments on current user’s posts in wp admin
- How to make author comment name to “Editorial Staff” no matter which ever author is replying to comments from his/her account?
- Changing the Comment Fields using Filter (without success)
- How to show username in reply to comment?
- Comments pagination: reverse JUST the links texts (1-2-3 to 3-2-1), not comments order
- Display date and time into post edit comments section
- Disallowed Tag Present in AMP WordPress ()
- Subcriber getting multiiple notifications for new comments
- Comments/Discussion Not enabled on newly created posts/pages
- Commenter username copies author username
- Fire Social Annex Code on Comment Approval
- How can I enable commenting from mobile view?
- Comments closed but enabled on edit screen
- Let user delete comment on front end only
- How to force users to nest their comments
- jQuery to Create Button to Show/Hide WordPress Comments and to Hide Comments by Default
- Comment form – different title if no comment yet
- WordPress Comments jQuery Doesn’t submit
- Insert comment and still use moderation
- Loop not displaying comments_popup_link
- Display of comment_date within get_comments?
- How to batch convert comments to posts?
- Customize comment notification e-mails with HTML
- prevent duplicate comments using wp_insert_comment
- I need help about wordpress of members section
- comment_approved custom value
- TinyMCE in comment reply form showing toolbar but can’t edit reply
- Add pending for reply comment in console WordPress