Send email messages after comment was submitted

For comment approved, you can review this question Approve comment hook? For comment submitted, you can hook into the comment_post hook, like function show_message_function( $comment_ID, $comment_approved ) { if( 0 === $comment_approved ){ //function logic goes here } } add_action( ‘comment_post’, ‘show_message_function’, 10, 2 ); Code copied from https://developer.wordpress.org/reference/hooks/comment_post/

How to create post comment from different domain

This quite rare setup so it is hard to recommend one way or another. Having worked with comments before I would recommend to stick with WordPress API functions (wp_insert_comment() and so on) for manipulating them. While DB structure is indeed simple you don’t account for all the hooks firing and other things that might be … Read more

How are readers authenticated for leaving comments?

By default passwords are encrypted using 8 passes of MD5. There are other ways to configure the password encryption. (https://codex.wordpress.org/Function_Reference/wp_hash_password) The hashes are based on custom keys setup in the wp-config file when creating the site. They are stored locally and not on WordPress.com You can make users register to leave comments or you can … Read more

Same comments on all posts

I was able to reproduce the issue. It’s being caused by the loop in your code: <?php if (have_posts()): ?> <?php while (have_posts()): ?> Replace that standard loop with if ( have_comments() ) {…, like this: <?php if ( have_comments() ) { ?> // The title, content and some other html here wp_list_comments(array( ‘callback’ => … Read more

wp_new_comment requires author url and author email

The example from the codex, the array of argument is now required. global $post, $current_user; //for this example only 🙂 $commentdata = array(‘comment_post_ID’ => $post->ID, // to which post the comment will show up ‘comment_author’ => ‘Another Someone’, //fixed value – can be dynamic ‘comment_author_email’ => ‘[email protected]’, //fixed value – can be dynamic ‘comment_author_url’ => … Read more

How to display category name from commenter’s custom post

You can use get_the_category This can be done by either using setup_postdata( $comment_author_post ) or by passing the post ID using $comment_author_post->ID USING setup_postdata() $args = array( ‘post_type’ => array( ‘post’ ), ‘post_status’ => array( ‘publish’ ), ‘author’ => $comment->user_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 1 ); $comment_author_posts = get_posts( $args ); … Read more

Additional content every x comments

Here’s one approach using the following custom input arguments: wp_list_comments( [ ‘_inject_period’ => 5, ‘_inject_content’ => [ ‘AAA’, ‘BBB’, ‘CCC’ ], ] ); where we setup the inject period and define the content to inject. This could be supported by the following demo plugin that extends the \Walker_Comment class and enhances the start_el() method: <?php … Read more