Questions tagged [wp-comment-query]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Best method for comment section associated with different images?

I would like to create a site where users can upload images and then all users can make comments associated with this image. Because users can upload multiple images I cannot make a new wordpress page ...
jdbrown444's user avatar
0 votes
0 answers
46 views

Restrict users to see only own comments and the post author's replies

I've chosen to use the default WP comments as private messages between readers/users and post authors, so that users are restricted to only seeing their own comments and the post author's replies. ...
Yurié's user avatar
  • 1,111
0 votes
0 answers
21 views

Get approved comments or comments that the author is me

This is how we can get the approved comments. $comments_query = new \WP_Comment_Query([ 'status' => 'approve', ]); And this is how I can get my comments. $comments_query = new \...
Steve Moretz's user avatar
0 votes
1 answer
40 views

comments_where Hook

Is there a similar replacement of the hook posts_where for comments (WP_Comment_Query)? I need to modify the where clause for a comments query like it is shown in this tutorial (“4. Sub custom field ...
Silas_229's user avatar
0 votes
1 answer
37 views

Comment Table Size Results in Slow Page Loads and 500 Errors

I manage a small site that has a very active comment area. The site is on shared hosting. There is a daily post entry, then a robust comment area. It is not untypical to have more than 100 comments on ...
Rick Hellewell's user avatar
1 vote
1 answer
271 views

How to make comments private for commentor and post author

I am trying to make comments private. I mean comment must be visible for post author and comment author. I create custom comment section "better-comment.php". I have used pre_get_comments ...
Teymur Abbasov's user avatar
0 votes
0 answers
80 views

prevent get_comments() from returning comments not in comment__in

The query string comment__in takes an array of comment IDs to include. I have an array of comment IDs that I would like to assign to comment__in, such as $args['comment__in'] = $comment_IDs;. Some ...
Fabian Amran's user avatar
0 votes
1 answer
395 views

How do I change the text content of a div for a comment validation error message?

My comment form has validation so that when a user tries to post a blank comment, it currently shows the "This field is required" message under the comment box. How do I change the message ...
Scarlett's user avatar
0 votes
1 answer
798 views

Display the list of user's comments + the post title + date

I am trying to display the current user's ALL comments in a specific page and I'm using this code (uses a shortcode): https://blog.ashfame.com/2011/01/show-recent-comments-particular-user-wordpress/ ...
cloyd concepcion's user avatar
0 votes
1 answer
184 views

How is the author's name given a different color?

Author's and visitors' names use the same color in comments.The point here is that the color of the author's name is different in the comments. For example, in visitor comments, name is red. But, the ...
A. Muller's user avatar
0 votes
1 answer
71 views

How to put this result inside that result?

I want my comment results to put inside anoher result. I want this result $args = array( 'post_id' =>$post->ID, 'status' => 'approve', ...
Bikram's user avatar
  • 338
0 votes
0 answers
51 views

How to show total comments count of the current logged in user?

I'm creating a custom user status page for my members. I need to show the comments count of the wp_get_current_user(). I looked at WP_Comment_Query but unable to understand anything. My conditions ...
Bikram's user avatar
  • 338
2 votes
1 answer
229 views

How would I count the number of times a comment meta field's value is in a post's entire comments?

How would I count (and display) the number of times a comment meta field's value is a post's entire comments? e.g. meta key is "fish" and key value "shark" appears in 5 comments of a post.
Pete's user avatar
  • 998
1 vote
1 answer
2k views

How to query comments only for the current post?

I am using ACF and my comments have custom fields. I also have custom post type called cars. What I'm trying to do is to make users comment their average consumption, and then I calculate average ...
David's user avatar
  • 87
2 votes
1 answer
1k views

WP_Comment_Query with 5 top level comments per page?

I'm trying to replicate the option in WordPress's settings page that says: [x] Break comments into pages with ((5)) top level comments per page and the ((first)) page displayed by default Right now ...
Swen's user avatar
  • 1,364
4 votes
2 answers
2k views

Custom WP_Comment_Query with pagination and orderby?

I'm trying to setup a custom WP_Comment_Query which is ordered by a meta key. (It might be worth mentioning that these comments are being retrieved with AJAX.) It all works fine, until I add in ...
Swen's user avatar
  • 1,364
4 votes
1 answer
577 views

Exclude comments from a WP_Query object?

I have noticed that the default WP_Query object also contains all of a post's comments. global $wp_query; print_r($wp_query->comments); // Prints an object containing all of a post's comments ...
Swen's user avatar
  • 1,364
0 votes
3 answers
6k views

Trying to get property of non-object notices in comment-template.php

I need some customization of WORDPRESS comment area, so I've used this code in my child theme : <div id="comments" class="x-comments-area"> <?php if ( have_comments() ) : ?> ...
Omid Toraby's user avatar
1 vote
1 answer
2k views

List user comments in author page

I'm trying to display a list of the author comments in the authors page but it only shows No comments made. How can I list user comments in the authors page? <?php $args = array( 'user_id' =&...
Frank Olson's user avatar
3 votes
1 answer
192 views

WP_Comment_Query() displays "password protected" comments?

It appears that looping through wp_comment_query() with the argument post_status set to publish also lists comments that are posted on password protected posts. Is this the correct behavior or is ...
Christine Cooper's user avatar
  • 8,768
1 vote
1 answer
2k views

Exclude child comments in get_comments() or WP_Comment_Query?

How do I only get the first level of comments in get_comments() or WP_Comment_Query? I want to query the comments which have 'comment_parent' => 0, and exclude all the child comments. $args = ...
Mohammad Sayed's user avatar