You can circumvent the check for empty comments easily by adding the uploaded image as HTML to the comment text:
add_action( 'pre_comment_on_post', 'allow_empty_comment_text' );
function allow_empty_comment_text( $text="" )
{
if ( ! isset ( $_POST['comment'] ) or '' === trim( $_POST['comment'] ) )
{
$img = '/* Process uploaded image here, create an <img> tag. */'
$_POST['comment'] = '<img>'; // use a real img tag here
}
}
Related Posts:
- How to use a custom comments template
- Comment visibility
- Get comments for more than one post
- Add placeholder attribute to comment form fields
- Allowing more elements in comments via functions.php
- Set post comments open function
- “Categories” for comments?
- Allow anonymous comments, but prevent spam [closed]
- Where to remove from comment’s feed?
- Why are default comments deprecated?
- Allow guests comments on single post
- Delete all user comments
- Why do I get email notifications about comments that WordPress has already determined are spam?
- Delayed commenting
- “Leave a comment” link even when you can’t
- An action hook where a comment meta is updated
- Display number of comment replies
- User can post only one comment per day on one page
- How to Delete Old Comments by Date?
- Display comment meta data after quick update
- get_comments() where parent is not 0
- How to hide “Comments are disabled”
- Get number of comments per page
- WordPress comments just vanished even tho there are about 250+ of them. Where did they go?
- 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
- Restore trashed posts with comments
- How to import only certain comments from post[s]
- How to remove ‘Site’ in the comment form?
- Make wordpress comments work with include templatepath
- Removing from Comment
- How do you turn on comments for only the last page of a paginated post?
- Callback function argument which is required for wp_list_comments ()
- How to not load comments form on post preview?
- Sort/list/arrange comments by comment author in un-nested/no thread comments
- Archive comment w/o moving to spam/trash
- Get the top level comment ID
- Custom WP Comments Query with Nested Comments Possible? (Hierarchy/Depth)
- Log file reports SQL Error processing child comments
- 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
- Get Post ID within wp_set_comment_status hook
- How to implement comments on specific fields in wordpress?
- wp_list_comments renders incorrectly nested
- Alternative to the filter comment_reply_link
- Cancel comment filter?
- get_comments not working consistantly with post_id
- Comments are invisible, what’s the problem with wp_list_comments?
- 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?
- Safe to remove this: when using a 3rd Party Comment App? [closed]
- 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
- 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
- I need to disable Disqus comments pre-approval, but i can’t find where
- JetPack comment threads are displaying above comment box? [closed]
- How do i remove approved spam comments by date?
- Need Comment Link Help
- Page comes up blank using w3 total cache [closed]
- Comment Table Size Results in Slow Page Loads and 500 Errors
- 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 show username in reply to comment?
- Custom sort comments with select form
- Display date and time into post edit comments section
- Disallowed Tag Present in AMP WordPress ()
- Limit Comment Line Count – Add Read More Button
- Commenter username copies author username
- Fire Social Annex Code on Comment Approval
- Displaying comment rating stars in carousel
- Enable comments option
- Change Comment Text [duplicate]
- Comments closed but enabled on edit screen
- Let user delete comment on front end only
- jQuery to Create Button to Show/Hide WordPress Comments and to Hide Comments by Default
- Comment form – different title if no comment yet
- Auto approve all comments (editor)
- add field comment [duplicate]
- Let users comment on categories in WordPress
- 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
- How can I filter the user avatar displayed in comments? – get_avatar_url filter works everywhere but not in comments
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]