How do I automatically insert some text in the comment textbox on submit?

We can submit a comment without text as this function allows the user to submit a comment without any text in the textarea. Now all you need to do is hide the comment textarea with some display:none; css. if ($comment_data[‘comment_content’] == ‘%dummy-text%’) { $comment_data[‘comment_content’] = ”; // replace dummy text. } return $comment_data; } add_filter(‘preprocess_comment’, … Read more

Using a static callback on wp_insert_comment

When adding a hook with add_action(), the 4th argument is the number of arguments accepted by the callback function: $accepted_args (int) (Optional) The number of arguments the function accepts. Default value: 1 Your callback function, CanvasLd::learndash_new_assignment_comment, accepts two: static public function learndash_new_assignment_comment( $comment_id, $comment ) { Since the default number of arguments passed to the … Read more

How do I stop the comments going to my email?

First of all, you need to login to your WordPress admin area and go to Settings » Discussion page. From here, scroll down to ‘E-mail me whenever’ section where you will see these two checkbox options: Anyone posts a comment A comment is held for moderation Ref: https://www.wpbeginner.com/beginners-guide/how-to-turn-off-comments-notification-in-wordpress/

How to block comments and pings?

If you had posts and pages live before you made that change above you will have to go to those pages and turn off pings and comments as well. Go to the Page list and in the backend, select all your pages (checkbox) and then under “Bulk Actions” choose edit. Under the Comments dropdown set … Read more

Comment Link from get_comments()?

You’re really close! Add #comment-<?php comment_id(); ?>to the href to append the anchor link <a href=”<?php echo get_permalink($comment->comment_post_ID);?>#comment-<?php comment_ID() ?>”> <?php echo $post->post_title; ?> </a>

How come pending comments are appearing in admin?

Your dashboard got alerted by trackbacks and pingbacks. Check the links for more info. As @eileen.carpenter mentioned on the comments, you should uncheck Allow link notifications from other blogs (pingbacks and trackbacks.) in your dashboard for them to be disabled. If you approve them, they’ll appear as comments in your posts/pages. Depending on the theme, … Read more

Why could my comment_form variable not be working?

This code makes no sense: function my_fields($fields) { $fields[‘new’] = ‘<p>red rover 1</p>’; return $fields; } add_filter(‘comment_form_top’,’my_fields’); I’m not even sure what it’s supposed to do, because comment_form_top is an action, not a filter. If you want to add extra fields, you should be using the comment_form_default_fields filter: add_filter(‘comment_form_default_fields’,’my_fields’); However, this might not work or … Read more