Questions tagged [comments]

Comments allow your website's visitors to have a discussion with you and each other. When you activate comments on a Page or post, WordPress inserts several text boxes after your content where users can submit their comments.

Filter by
Sorted by
Tagged with
0 votes
1 answer
13 views

Easily invalidate form in comment_post hook

$GLOBALS['test'] = 'a'; function comment_post_check($comment_ID, $comment_approved, $commentdata) { $GLOBALS['test'] = 'b'; } add_action('comment_post', 'comment_post_check', 10, 3);...
  • 109
0 votes
0 answers
11 views

The last comments of a post for the author of that post

I have a project that is managed by several authors. Our comments section receives thousands of comments daily and we need each author to be able to view the latest comments received on their ...
  • 1
0 votes
0 answers
15 views

Page to view single comment and all replies

I often have comments that get dozens of replies where users end up having a discussion. I want to show only a few replies for a comment on the post page and give an option to "view full thread&...
0 votes
0 answers
17 views

Add ACF Quick Edit Columns on Comments

I'm using ACF to add a custom field to all comments. It's an optional checkbox with categories that the commenter can use to categorize their comment, which we use for filtering later on. From within ...
  • 101
-4 votes
1 answer
122 views

Undefined Function Fatal Error with Shortcode [closed]

I asked AI ChatGPT: Can you develop a wordpress shortcode to create a list of users of a certain role and for each one show if they commented on a certain post (counting how many comments they left)? ...
0 votes
1 answer
12 views

TinyMCE in comment reply form showing toolbar but can't edit reply

I have added the TinyMCE editor for comments using comment_form_defaults hook with wp_editor. It works great for the comment form, but when replying to the original comment, the new comment form shows ...
0 votes
1 answer
18 views

Simple shortcode to check if a user has commented on a certain post

Hi all (mi first question on StackExchange, sorry in advance for my inability) I want to make a shortcode to check if the current user has commented on a specific post. I found this code as a starting ...
0 votes
1 answer
21 views

How do you fetch the authors email or IP from /comments? (REST API)

Does anyone know how to get the email and IP for Wordpress comments using the REST API? The docs. Are the fields just not provided in the response? "author_url" is there. But not "...
0 votes
0 answers
9 views

Comments not working (error not allowed) on posts with custom post status

I was able to make a custom post status using this codes: // Registering custom post status function wpb_custom_post_status(){ register_post_status('rejected', array( 'label' ...
  • 11
0 votes
0 answers
19 views

Is there a Function so that the author of the comment can delete his own comment?

Is there a possibility to put a link so that commenters can delete their own comments? I need something simple that doesn't need to install a plugin and I haven't found a solution. I just need a link ...
0 votes
0 answers
28 views

Get comment number by date range?

I want to add a fire icon to the posts that have received more than 10 comments in the last 7 days. The function to retrieve comment numbers get_comments_number() doesn't have a date range. So how do ...
1 vote
0 answers
17 views

Error 403 when posting comments to a custom post type from a different page

Im trying to make a simple ticket support system by using custom post type, comments and a page. So it works like this, User creates a ticket with details and it's inserted into the custom post type &...
  • 11
0 votes
0 answers
16 views

How stop the process of submitting a comment if a fields are empty?

How stop the process of submitting a comment if a field is empty? <form action="http://localhost/test/wp-comments-post.php" method="post" id="commentform" class="...
0 votes
1 answer
26 views

How to disable comments on new blog post, but allow on new products?

Under the discussion setting, when I uncheck the “Allow people to submit comments on new posts” setting; it is disabling comments on new blog post. But it is also disabling review section of any new ...
  • 3
0 votes
0 answers
26 views

How to make comments reply work in my website?

I am trying to make the threaded/nested comments work in my theme, but wiht no success. Tried code snippets, custom js codes and other alternatives, but cant make it work. Already enqueued the scripts ...
0 votes
0 answers
13 views

How to Allow Users to Select Recipients In a WordPress Comment section?

Are there any plugin or ways to allow users select recipients and send them notification according their email address? For example if person select IT department I would like to send notification ...
0 votes
0 answers
12 views

How can comments be turned off for media attachments on Wordpress?

I want comments always turned off for media attachments. I wrote the following codes to accomplish this. But this code is not working. I've also reviewed many similar topics: Resource-1, Resource-2, ...
0 votes
1 answer
13 views

Replace Entire Comment Box with Text

I have a need to disable comments for a specific group of users. But I want to replace the entire comment box with a message like "Sorry, you are not allowed to enter a comment". Other users ...
0 votes
1 answer
26 views

Preferred method to get comment reply link for comments with a depth of 0

By default, get_comment_reply_link doesn't work for comments with a depth of 0, since the function contains the statement: if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) ...
0 votes
1 answer
21 views

comment_approved custom value

I want to modify comments with an additional 'comment_approved' value. This value will be used elsewhere in a plugin that uses wp_list_comments. Looking at the wp_set_comment_status function, I see ...
0 votes
0 answers
16 views

Comment turned Invisible

Please help me with this problem. People can comment, and the database shows the commented data. but the website is not displaying them. They are just showing blank space. (Just the username of the ...
0 votes
1 answer
10 views

get Discussion setting in wordpress

I am writing a shortcode for comments i need to know if admin wants users to logged in for commenting i need to know this option user must be registered and logged in for commenting is there any ...
0 votes
1 answer
15 views

How t Remove Labels from comment Box

I am learning to create custom theme. I have enabled default WordPress Comment for but I dont like how labels are appearing. Is there any way to remove labels and put placeholder text instead? ...
0 votes
0 answers
26 views

How to auto-generate names for guest users who leave comments?

Along with disabling the URL and email fields in comments, I'm experimenting with auto-generating random names (e.g. nicknames like "Harry" or "Larry") for guest users in order to ...
0 votes
1 answer
105 views

How to hide and disable URL and email fields from comments?

How can I hide and completely disable (in case of bots) the URL and email fields in comments? There are a few free plugins that seem to do this, but most of them only hide the URL field and not the ...
0 votes
1 answer
44 views

Auto delete WordPress comments

Is there a way to delete pending WordPress comments after X days? I looked into do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' ); but now sure how to take it from here.
  • 11
1 vote
1 answer
32 views

Are There Comment Text Revisions

Assume that users have the ability to edit their own comments. Or administrators can also do that. Do comments have revisions like posts and pages? If so, how would you access those revisions? The &...
0 votes
0 answers
16 views

Refresh individual comment text via API

Assume that I am viewing the comments on the front end. And that I have added a 'refresh' link next to the 'edit' link that appears because I am logged in as admin. I need to be able to refresh that ...
0 votes
0 answers
30 views

How to load new posts from wordpress db into wordpress homepage without refreshing the site?

4.5 Hasan Mahmud to Madhevere, no run 4.4 Hasan Mahmud to Madhevere, no run, good length delivery outside off stump, Madhevere defends off the back foot 4.3 Hasan Mahmud to Madhevere, no run, full ...
0 votes
0 answers
14 views

how show attachment image in comments query

I have a website where users can post comments for posts and attachments, with this code show last 3 comments in footer, comments for posts shown good with thumbnail as image but for attachments image ...
  • 1
0 votes
0 answers
13 views

displaying the last product comment in the woocommerce category

Good day! The task was set to display the last comment on woocommerce products in the parent category. Each product has its own last comment, if there are no reviews, nothing is displayed. As an ...
0 votes
0 answers
48 views

Why will comments not remain open on custom post types?

I have a WP install which makes use of default posts and of one custom post type (reviews). Discussion settings allow comments on both these post types. The comment form is present when viewing posts ...
  • 29
0 votes
1 answer
72 views

Delete/Spam Comment Button

To add a 'spam/delete' button to an individual comment, you can use code similar to this $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->...
0 votes
0 answers
50 views

Allow / show post comments in category pages

Is there any way to allow the users of a website to write comments (and also see the already published comments) on one post when it's displayed in a category page? I'm not looking to let the category ...
  • 1
0 votes
1 answer
33 views

Check if user has comment on current post

Hello I have multiauthor website and I need to create a condition to check if defined user ( no current user ) has comment on current post. Here is my code but I can not complete this $userid = "...
0 votes
1 answer
89 views

reCaptcha doesnt appear in comment (manual or plugin)

I tried the following: https://www.quora.com/How-can-I-insert-Captcha-code-in-WordPress-theme-without-using-any-plugin https://codeforgeek.com/add-google-recaptcha-wordpress/ https://pluginsforwp.com/...
  • 61
0 votes
1 answer
25 views

How do I add <div> tags to entire comments, not just their text

Thanks to some wonderful help here at stack exchange, I have built a comment section with a dropdown menu that adds comment_meta to the comments. I currently have a working filter that uses GET to ...
0 votes
1 answer
58 views

wp_delete_comment takes two tries to delete - then deletes all comments

I'm trying to add a button to my comments that allows a user to delete them. I have a form declared like so: <form method="post"> <input type="submit" name="btn-...
0 votes
0 answers
10 views

Comment Reply Link Reloading Page Instead of Moving Comment Form [duplicate]

In my comments.php, I loop through the comments like this: if (have_comments()) : ?> <ol class="post-comments"> <?php wp_list_comments(array( '...
0 votes
1 answer
64 views

How to filter comments by comment_meta

EDIT: Yay, solved it! I needed to use new WP_Comment_Query( $args ) and set my $args to only include the current post and the meta chosen. Thanks! Thanks to the wonderful help of the community here, I ...
-1 votes
1 answer
100 views

Clicking Comment "Reply" Button only replies to first comment

I'm editing my comments.php, and within it I've added a reply button like this: <div class="reply"> <a rel="nofollow" class="comment-reply-link" ...
0 votes
1 answer
22 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 ...
0 votes
1 answer
69 views

How to get comment images stored as serialized comment meta

I want to display images under for each comment but images store in database as serialized a:3:{i:0;i:775;i:1;i:776;i:2;i:777;} I wrote this code print_r (get_comment_meta( $comment->comment_ID , '...
0 votes
1 answer
51 views

Get all comments of author's posts

Hello I have multi author website. I want to display all comments of posts created by author in author page. Please help me. I found this code but fatal error <?php $args = array( '...
0 votes
0 answers
17 views

Prevent users to delete comments from trash

As told in the title, I am looking for a way to prevent users to delete comments from the trash. Only admins should be able to. I tested the scripts at: Function to prevent users from trashing ...
  • 1
0 votes
1 answer
27 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 ...
0 votes
1 answer
68 views

Rewrite comment form post ID on submit

I have a WordPress comment form, with a custom field (added with the Advanced Custom Field plugin) where the visitor can chose from a options (these are page IDs). When submitting the form, I want ...
  • 1
0 votes
0 answers
21 views

Wordpress comment processing . Default unapproved comments detection before posting

I am working on wordpress comment section. I understand that when we are posting some comments for example comments with many links, then WordPress storing this comment in to the database with ...
  • 25
0 votes
1 answer
16 views

Hide comments on specific pages, not just disable future comments

When I consult Google about how to remove or hide comments on certain pages, the answers seem to be "all or none." That is, there are plenty of explanations as to how to disable further ...
  • 117
0 votes
0 answers
26 views

Insert ads between comments

I want to insert ads between comments. function wpse_comments_ads_injection( $comment, $args, $depth ) { static $count = 0; if ( $count == 2 ) { echo "AD 1"; } if ( $...

1
2 3 4 5
38