Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [get-comments]

The tag has no usage guidance.

0
votes
1answer
23 views

The comment could not be saved. No comment_ID on comments

Every time I try posting a comment logged in as an admin, I get the following message: [ERROR: The comment could not be saved. Please try again later.] But when I actually go to the database, I find ...
0
votes
1answer
106 views

How to stop ultimate members to redirect comment authors to user profile?

I'm having a problem with the Ultimate Member plugin. The comments author links get redirected to the user profile. I need the basic WP feature- pointing to author URL/website. The plugin is ...
0
votes
0answers
24 views

How to get the current Comment hierarchical child level?

........ ...... .... .. $comment = get_comment( $comment_id ); ?> <div class="level-<?php echo $comment->child_level; ?>"> ........... </div> Like this, how to get the ...
0
votes
2answers
41 views

Custom Comment Notifications Fire on each Page Load

I have written a custom function to notify, by email, a set of users whenever a post has a comment submitted. The users updated vary from post to post and are defined by an array containing their ...
0
votes
1answer
845 views

How do I get the latest note on the order at woocommerce? [closed]

I want when the order is placed in the (processing) position Send SMS to the customer, how can I get the last note in the order and put it in the ( %comment% ) key? if ( isset( $this->options['...
0
votes
1answer
44 views

Getting comments of an specefic user

i am using this code: $args = array( 'user_id' => get_current_user_id(), ); $comment = get_comments( $args ); var_dump($comment); wp_list_comments("callback=wpsaz_comment&end-...
0
votes
1answer
100 views

Display comment meta data after quick update

I have few custom comment field - phone, stored as comment meta. On comments edit page (edit-comments.php) I display this value in custom column. I also display these values on post edit page (post....
1
vote
1answer
387 views

Custom WP Comments Query with Nested Comments Possible? (Hierarchy/Depth)

I've set up a custom WP Comments Query that serves approved comments on posts ordered by date (basic stuff) and everything works fine except the fact that comments are displayed below each other and I'...
0
votes
2answers
22 views

Enable comments option

I have tried ticking comments and discussion but still don't seem to have a comments box. Even went through and ticked individually for each post. Help!
2
votes
1answer
46 views

Making shortcode of filtered number of comments by user role

function comments_shortcode($atts) { $current_user = wp_get_current_user(); . . . extract( shortcode_atts( array( 'id' => '' ), $atts ) ); $num = 0; $...
4
votes
2answers
533 views

Showing comments only to same custom user role

Is there a way I could show only the comments by a particular user role to his same user role? For example: The logged in user belongs to the "Advertisers" user role, he should only see the comments ...
1
vote
2answers
84 views

Create Page To Count Comments For Each Post In Wordpress Site

I'm trying to count the number of live comments on each post. I would like to extract them on a custom page like http://example.com/count.php and have them output like this: http://example.com/the-...
0
votes
1answer
516 views

How to get the 5 most recent comments and each comment 5 most recent replies (children)

I want to get the 5 most recent comments and each comment's 5 most recent replies (children) in descending order. With the following code I can get the 5 most recents comments but it won't distinguish ...
1
vote
2answers
714 views

List comments received by every posts of an specific author

The wordpress built-in get_comments() can easily list out comments base on post type, post meta, post id or comment author id. But I would like to bring them togather, list out recent received ...
-1
votes
1answer
742 views

Get Comment With Meta value

I need get all comments of a post including of the meta value.. for eg. i need all comments fields + a meta value. i tried the following code to get but.. its not working $args = array( 'status' =...
0
votes
0answers
965 views

Create Custom Comment Type

I have a page when I want multiple comment_template, so I want each of my comment_template to have different type so I see different comments in those 2. My get_comments look like this $args = ...
1
vote
1answer
1k views

Show comments in a popup

I want to show comments in a popup for the page with id=22. This is the anchor on whose click the popup will open: <a class="button button-small button-line-light comment-popup" href="<?...
0
votes
1answer
29 views

Get Commentor IP When Marking Comment As Spam

What I am trying to do is create a list of IP addresses each time I click Spam on a comment. The only issue I have now is, how do I get the commentors IP address inside this function. This is what I ...
0
votes
0answers
40 views

How to create a designated comment page with custom fields

I'm creating a site where I want to use the comment box to auto-generate a FAQ page. In essence, when a comment is posted it won't appear on the same page as the comment box. Instead, it will be ...
2
votes
4answers
2k views

How to get replies of a comment?

Is there a way to get replies of a comment by its ID? I have searched on google but could not find anything about it. For example, I have a comment with ID 123 I want to display all the replies that ...
2
votes
1answer
27 views

How to check for specific content in comments in the loop

I'm using the following conditional code to check if any comments on a given post contains a certain string. -The word 'CHANGES' in this case. I have it working if I specify the comment_ID directly, ...
0
votes
1answer
1k views

How to exclude the child comments in get_comments() 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 = ...
1
vote
1answer
1k views

Get a List of All Commenters on the Current Post

I'm trying to get a list of everyone who's commented on a post, and then check that list against the current logged in user. If the current logged in user is included in that list, then I don't show ...
0
votes
0answers
361 views

get_comments() returns empty array if called through AJAX

I'm facing a quite strange issue with a simple get_comments() implementation in admin panel. Code is this (post ID is truly 1234) get_comments('post_id=1234&status=approve'); It returns proper ...
0
votes
1answer
158 views

Exclude specific user_id from args in get_comments

I'm basically using a 'latest comments' system on multiple pages where one specific user is listed as the first reply for a comment - highlighted with special CSS - and then 2-3 normal users below ...
0
votes
1answer
89 views

Problem displaying replies as part of author's latest comments on author page

I've based a lot of my method on this thread here I can currently display 5 latest comments on an author template page. I want to display the latest 3 replies from any user for each 'main' comment (...
0
votes
1answer
549 views

get only one last comment from each post

Lets say I have 5 posts where most recent comments placed. How can I get one comment per each of these posts? I want to use get_comments(). Is it possible? Post1: Comment 1 Comment 6 Post2: ...
1
vote
2answers
79 views

Commenter should see only his comments in wordpress

I'm building a site for a research and my participants will be all logged in to use the site. I would like to make these participants able to see only their own comments, so other users' comments will ...
1
vote
1answer
671 views

get_comments not working on custom post types

I am trying to get all the comments of the logged in user in the "foods" CPT but I'm still with no success. Here's my code: <?php $args = array( 'user_id' => $user->ID, '...
0
votes
2answers
30 views

Is there a better way to check for a new comment?

I have some code that runs on the client that checks every 30 seconds or so for new comments, and if a new comment is found the user is alerted. The check count the comments on a page, and returns ...
1
vote
2answers
788 views

get_comments not working consistantly with post_id

I am trying to get comments from another post. I am getting the post_id and doing a check to see if it has comments I can get the comments for the current post every time but for the other post I am ...
0
votes
1answer
1k views

Custom Nested Wordpress Comments with avatar

I am developing a theme and has no idea how wordpress handles the comment outputs. I have wp_list_comments in my comments.php, but I'm not sure how to customize the output to get the desired output ...
0
votes
1answer
890 views

How to get comment_ID by post_ID in wordpress

I used get_comment() but its parameter is $comment_ID which I has to enter manually for previous comments from wp_comments instead of that I need to get current comment means last updated comment ...
0
votes
1answer
113 views

Adding Parameters to get_comment

I have a code like this: <?php $comments = get_comments( 'post_id=' . $post->ID ); echo get_comment_author($comments[0]->comment_ID); ?> <br /> <?php $comments = get_comments( '...
4
votes
1answer
3k views

How to limit users to one comment per post

I am using WordPress as a petition site and hacking the comments system to work as the petition signup. I would like to find out how I can limit a user to post only one comment per post. So far I can ...
0
votes
0answers
667 views

Comments orderby comment date not working

I have a template to get the comment replies to a user and display it on a static page. It works reasonably well in so far as the correct comments are displayed but whatever I try I can't get the ...
0
votes
1answer
37 views

How can I grab and show the reader comments of my site

How can I grab and show the reader comments of my news site in a different page? Suppose, I have comments on a news site, into my posts. I want to show the comments (only the comments) into a ...
0
votes
1answer
3k views

How does “Your comment is awaiting moderation” work?

The question here is if someone could help me to make the comment "Your comment is awaiting moderation" work correctly for custom page. It works ok for standard Wordpress page but not for my own page. ...
2
votes
1answer
1k views

Comment `Reply` link doesn't work if comments are loaded from ajax

I am writing a plugin that displays custom home page that is in fact only one post with comments. The first time home page is displayed by the initial call by php. Then user can click a menu button to ...
0
votes
1answer
138 views

Inserting a random number into an array [closed]

So what im trying to do is make a random offset for 'top comment', at the moment it's working great(with no offset) but I want to randomise the offset so it displays 1 of the top 5 comments by ...
0
votes
1answer
563 views

Change Wordpress comments url / word

Is this possible? For example, I want to change http://mysitesitesite.com/post-name/comment-page-1/#comment-452 to http://mysitesitesite.com/post-name/custonname-1/#customname-452 What should I ...
0
votes
2answers
167 views

How to get posts and comments amount per hour, per year and per month?

I have this snippet: function count_user_comments_today( $uid ){ global $wpdb; $today = date('Y-m-d'); $tomorrow = date('Y-m-d', time() + 86400); $count = $wpdb->get_var( $wpdb->...
0
votes
2answers
487 views

Get first comment link on the post itself

I have this function and a link to a post: <?php foreach ($results as $id) { $post = &get_post( $id->ID ); setup_postdata($post); <li><a <?php href="<?php ...
0
votes
0answers
126 views

Get url/link to latest comments in a post

I have a post list in WordPress where people can see the most recently commented posts. They will appear above the list. That's fine, but now, I have 300 comments on the same posts and I don't want ...
0
votes
3answers
6k views

Getting comment count per post not working

I have this function: <?php $popular = new WP_Query('orderby=comment_count&posts_per_page=5'); ?> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <li&...
0
votes
1answer
110 views

How to get recent comment link

I'm getting 5 recent comments into my sidebar using the following code: <?php $recent_comments = get_comments('status=approve&number=5'); ?> <?php foreach ($recent_comments as $comment) {...
0
votes
1answer
58 views

Author page link in comments is different than in posts?

When I hover over the comment author link on my comments, it shows a link like http://mysitenameeeee.com/?author=24 After I click it, it gets me to /author/authorname, which is fine, but I don't want ...
1
vote
1answer
832 views

How to get most recent commented post above new submitted post in Wordpress?

I have this function: $ids = $wpdb->get_col("SELECT DISTINCT comment_post_ID FROM $wpdb->comments ORDER BY comment_date DESC LIMIT 0 , 30"); foreach ($ids as $id) { $post = &get_post( $...
0
votes
1answer
248 views

Get comments only for certain specific users in template file

To return comments for a specific user, I use the code below: $arg = array('user_id' => $userID); $coms= get_comments( $arg ); How can I modify the arguments of this function so that I get ...
0
votes
3answers
212 views

Show comment number per author per day

Is this possible? I've never seen it used, but I need it... I want to show for each author (if they are logged in) on their own profile page, the amount of comments they have posted today. If the day ...