WP_Comment_Query
doesn’t pull comment meta. You can search by comment meta but the query doesn’t return that data. You could easily check this yourself by looking at the Codex.
You need to loop over the results and run get_comment_meta()
, or essentially do the same via a filter on the_comments
.
It is also possible to add to the data returned by filtering the “fields” clauses:
function add_cmeta_wpse_212423($clauses){
// var_dump($clauses);
global $wpdb;
$meta = "(SELECT meta_value
FROM {$wpdb->commentmeta}
WHERE (
comment_id = comment_ID
AND meta_key = 'test_comment_meta')
) as test_comment_meta";
$clauses['fields'] .= ', '.$meta;
return $clauses;
}
add_filter('comments_clauses','add_cmeta_wpse_212423');
I created a subquery. You could create a JOIN
as well.
Related Posts:
- Why does comment_reply_link launch the reply form at the wrong spot on the comment section?
- Threaded Comments Feature not working
- customizing TwentyEleven comments template
- Enable nested comments in Theme
- Remove the function which adds nofollow to links in comments
- Removing(replacing) avtar in comments.php with some other HTML arrangements
- Cannot display comment in page
- How to wrap submit button of comment form with div
- Comment Walker vs. Comment Callback
- comments reply script not working
- Why does `add_theme_support( ‘html5’, array( ‘comment-form’ )` disable client side validation?
- Add class to Reply button in Comments area
- How do I set up real anonymous posting in bbpress forums? [closed]
- How to allow the reply link to remain on the comment form after I have reached my 10 nested comment limit?
- Deep customization of the comment form?
- Custom Comments – Parent / Nested Reply
- Why are default comments deprecated?
- Comments Reply Form
- Comment form not display properly?
- Comment form not showing up without comments
- Change “logged in” link in (you must be logged in to post a comment)
- Change the tag of the comment submit button
- changing default comment form arguments [duplicate]
- customize comment form
- adding a text message beside the comment submit button
- How to save new comment as custom comment type?
- WP comments form (custom) is displaying an extra comment field
- How to modify comments form using comment_form()?
- Publish a message on facebook after having posted a comment
- Including new Javascript only after a comment is made
- Two steps comment form
- How to call my custom WordPress Comment form without getting the comments?
- How can I get values count from wp_commentmeta?
- How can I test why the comment hook is not working?
- How can I convert anonymous commenters into registered users?
- How to modify core when there is no hook?
- blank page after submitting a comment
- changing font size and font of a custom message added after comment
- Force logged in users to still fill out name/address for commenting?
- Wrapping the cancel_comment_reply_link()
- Does anyone know all parameters of get_comments()
- Display avatar with comment form?
- Commentform input area issue
- How to make comments private for commentor and post author
- Name of comment field differs on different sites
- How to display comments length
- how to load the comment template from a plugin
- Full Front End, AJAX comment system and comment reply script
- get_comments_number() returns 0
- duplicate comment section functionality and call it something else for custom post types
- How to create post comment from different domain
- Get comment id of the individual comments in comment list when modifying comment posted using comment text filter
- Custom comment-field form arrangement [closed]
- How can I embed comments plugin to my own website?
- Custom comment field not showing when logged-in
- How to add a category to comments?
- Comments on future posts
- Create customized captcha field to wordpress comment form without Plugin
- get_comment_meta not behaving as expected
- Add a Custom Field in Comment Box next to the Text area
- Returning error upon comment being flagged as spam
- How to auto-generate names for guest users who leave comments?
- Clicking Comment “Reply” Button only replies to first comment
- How to create a classified section in place of comments_template
- Changing the Comment Fields using Filter (without success)
- How to send add_comment_meta value from separate file to main plugin file?
- COMMENT FORM Error: Please type your comment text
- Cannot Remove Title Reply from Custom Comment Template for Signup Page
- How do I make the comment disappear after deleting from the database?
- comment just attachment .. reply just text … can I do that?
- Custom sort comments with select form
- Display the list of user’s comments + the post title + date
- Same comment section on every page
- reply comment below the comment box without reload page
- How to find which last line executed in wordpress?
- Force to show all fields in comment forms to the logged-in users
- Hide review form if user has left a comment
- How do I check which comment fields are required in my theme?
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- How to make comment reply available only for login members of a certain user roles only?
- Can not edit comment form
- How to call out the date of user’s first comment?
- edit comments in front end
- How to replace anonymous comment form with a registration form on wordpress?
- Show comments based on user role in front end
- How do I write this code to not show default on label_submit?
- How to edit comments form on posts?
- How to echo PHP after comment form submit?
- Echo out custom fields in comments
- Comments template only linking to one post
- Comments not enabled for custom post types
- Adding restrictions to open comments
- Insert comment and still use moderation
- Customized Comment Form Issues
- add field comment [duplicate]
- Add custom captcha to comment form
- Why default comment fields don’t show up?
- How to enable truly anonymous posting in bbPress forums? [closed]
- Replace Entire Comment Box with Text
- Is there a way to edit the markup of comment_form()?