Skip to main content

Questions tagged [wp-comment-query]

The tag has no usage guidance.

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

Inherit args from the main wp_query or wp_comment_query to my custom query

I want to create a custom wp query but inheriting the args of the main query both for wp_query and the wp_comment_query. WP QUERY: $args = array( // custom args ) // Here I need some method to join ...
Stefano's user avatar
  • 23
0 votes
0 answers
12 views

Paste URL In comment It auto turn to default title of page with link

Looking something like: when i comment a url on my wp post it will auto convert to its default title with hyper link. example: Right now when i comment URL https://www.google.com/ it looks like: https:...
Jimmy's user avatar
  • 1
0 votes
1 answer
42 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
44 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
359 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
96 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
436 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
899 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
206 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
72 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
242 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
  • 1,028
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,374
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,374
4 votes
1 answer
598 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,374
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
194 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,798
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