You should be able to do a meta_query
in a WP_Comment_Query()
:
$args = array(
'post_id' => 'post-id-here',
'meta_query' => array(
array(
'key' => 'fish',
'value' => 'shark',
'compare' => 'LIKE'
)
)
);
// Query the comments
$comment_query = new WP_Comment_Query( $args );
// Count the number of comments
$count = count ( $comment_query );
The WP_Comment_query()
accepts a 'post_id'
so you can search withing a specific post’s comments.
Related Posts:
- What for is the table “wp_commentmeta” exactly?
- Running a function on comment status change
- Is it possible to show custom comment metadata in the admin panel?
- WP_Comment_Query() displays “password protected” comments?
- Add Comment Custom Field
- Upload images with comment
- Add a drop down list to comment form?
- An action hook where a comment meta is updated
- What are the additional fields in wp_comments used for?
- Display comment meta data after quick update
- WP_Comment_Query with 5 top level comments per page?
- WordPress Comment. Need some details of wp_comments DB table
- Exclude child comments in get_comments() or WP_Comment_Query?
- How to query comments only for the current post?
- List user comments in author page
- Get comments from post and sort by commentmeta value
- How to sort posts by the average of comment meta values
- How to get a value from comment meta
- How to make comments private for commentor and post author
- Name of comment field differs on different sites
- How is the author’s name given a different color?
- Make every comment go to the spam folder
- How to display comment meta under each comment content
- Update comment meta for all comments of specific post
- How to get Post title by locale with Qtranslate-X
- get_comment_meta not behaving as expected
- How to filter comments by comment_meta
- comments_where Hook
- Comment Table Size Results in Slow Page Loads and 500 Errors
- Top rated posts Average rating issue
- WordPress Commenting System User access and Security
- Trying to get property of non-object notices in comment-template.php
- Add comment meta
- Comment-Meta doesn’t work with latest wordpress update
- add field comment [duplicate]
- Use country flag as user avatar based on comments IP address?
- The last comments of a post for the author of that post
- Best method for comment section associated with different images?
- Restrict users to see only own comments and the post author’s replies
- Get approved comments or comments that the author is me
- Disable comments on all posts/pages
- Stop WordPress redirecting comment-page-1 to the post page?
- Importing old Disqus comments into WordPress
- How to add a class to the comment submit button?
- Would switching to InnoDB from MyISAM improve performance of comments table?
- Linking to Page Showing Only Comments Without Parent Post
- Post Comments using WP REST API v2 in WordPress
- Show content only if member left a comment
- Using filter to add additional fields to comment_form()
- Disable wordpress comments API
- List Recent Comments from Across a Multi-site Network
- Comments waiting but no comments found
- Programmatically block commenting by restricting view of comment form
- count number of user comments with a specific comment meta value
- Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins
- How to add text to comment form #content textarea?
- Get most active users sort by comment count
- Passing arguments to wp_list_comments callback function
- comments_template not working correcly in custom template files
- Why are my comments closed?
- Is it possible to make wp insert last comment onto another page
- How to allow only Admins or Logged In Users to post links in comments?
- wp_insert_comment error. puzzled by date value
- Private replies for comments
- edit_comment capability for subscriber
- How to add attributes to the comment form tag?
- oEmbed does not work for comments
- Yoast makes comment_reply_link function output plain link to comment instead of reply link
- Same email for all comments
- List comments received by every posts of an specific author
- How do I reply to comments from admin panel on a tablet PC?
- Disable comments for a user? [closed]
- Polls with respective comments?
- Ajax submit comments
- In wp_list_comments comment dates won’t work?
- Where are comment ratings stored?
- how to SELECT for the current post id?
- Custom comment link
- How to display the user’s comment status on the front end
- get_comments_number() vs. get_post_field( ‘comment_count’, ID )
- Comments turned off, but ‘Leave a reply’ link still there [duplicate]
- How to output number of comments with link to comments
- How do I make Twenty Ten display comments on the home page?
- Sort post comments from newest to oldest in pagination
- Using Disqus with headless WordPress setup?
- Attaching author tag to the comment
- Delete comments function
- Comment form not working
- How to show a “Comments Are Closed” message on posts where comments have been closed?
- Comments pagination on author page
- Comments page id wp_list_comments
- Can I use WP comments for custom tables?
- How can I have a full comments.php for an easy editing of all its aspects?
- Transfer comments from one domain to another
- WordPress is adding above html
- Function to get a list of all comments on 1 post [closed]
- Display DISQUS on homepage
- comment awaiting moderation
- How do you fetch the authors email or IP from /comments? (REST API)
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]