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
- Paste URL In comment It auto turn to default title of page with link
- Nofollow the date/time hyperlink in comment
- How do I comment out a block of tags in XML?
- R: Comment out block of code
- Why do I get comment spam even with Akismet and Captcha?
- What tools are available for managing/writing to WordPress? [closed]
- How to rearrange fields in comment_form()
- setting comments off as default for pages and custom post types?
- Is it possible to pull comments from facebook into your blog?
- Find out which moderator approved comment?
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- Non-threaded comment replies with link to original comment
- Approve comment hook?
- Commenting in user profile page?
- How to change “You must be logged in to post a comment.”
- comment_post_ID 0 (cannot remove from dashboard)
- Disable comments on all posts/pages
- How do I delete all comments from a specific old blog post?
- Removing the “Website” Field from Comments and Replies?
- 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?
- How to wrap submit button of comment form with div
- How to enable comments for pending and draft posts?
- Using WordPress’ WYSIWYG for comments
- Enable Submit Comment Without Page Reload (Using Ajax)?
- Getting Post Comments for post ID using WP_Query() and a Custom Loop?
- Add option to disable comments on a per posts basis?
- Resetting comment count
- When importing – failed to import: Invalid post type feedback
- How to change the email notification recipient (user) for new comments?
- Redirect user to a custom url after submitting the comment
- Paginate result set from $wpdb->get_results()
- Change Comment Author Display Name
- Would switching to InnoDB from MyISAM improve performance of comments table?
- Custom comment type based on thread level
- How to add internal, revision comments to page updates
- How to load and show comments with AJAX instead of pagination?
- Linking to Page Showing Only Comments Without Parent Post
- Comment Reply javascript
- How do we remove the H3 tag for the reply-title I.D
- Comments not appearing at all
- comments reply script not working
- How to display comment form error messages in the same page
- 3 moderators to approve comment
- How to deal with small scale comment spam on small commercial sites? [closed]
- What should I do to make generated avatars different for anonymous comments?
- A plugin where users can comment with Facebook or Twitter or OpenID [closed]
- Check If comment author is registered
- Comments screen in backend, how to disable email address of commenter for non admins
- Add comments from the admin panel?
- How can I limit the number of comments per registered user per day?
- One comment per user per post but be able to reply to existing comments
- How to use a custom comments template
- Comment visibility
- What’s the easiest way to close comments on media/attachments?
- Reverse comment pagination numbers
- Get comments for more than one post
- How can I add comments to a page?
- How to remove comment spam in WordPress