How can I control the comment counts filtering my CPT replies?

Here are three different methods to modify the trash count, to 999 as an example: Method #1 The views_edit-comments filter: add_filter( ‘views_edit-comments’, function( $views ) { $trash_count = 999; // <– Adjust this count // Override the ‘trash’ link: $views[‘trash’] = sprintf( “<a href=%s>%s <span class=”count”>(<span class=”trash-count”>%d</span>)</span></a>”, esc_url( admin_url( ‘edit-comments.php?comment_status=trash’) ), __( ‘Trash’ ), $trash_count … Read more

Why does comment_reply_link launch the reply form at the wrong spot on the comment section?

Because that’s done in javascript, and you have to enqueue that javascript for it to work, as stated in the docs: If JavaScript is enabled and the comment-reply.js JavaScript is loaded the link moves the comment form to just below the comment. https://codex.wordpress.org/Function_Reference/comment_reply_link e.g. function wpse289875_enqueue_comments_reply() { if ( is_singular() && get_option( ‘thread_comments’ ) ) … Read more

Running a function on comment status change

The comment_post hook is called with a $comment_id as the first argument. You can see why your function is failing. Same goes for the edit_comment hook. Simply add the following at the beginning of your business function: if ( !is_object( $comment ) ) $comment = get_comment( $comment ); Do use a custom SQL query for … Read more

Show comments from multiple post IDs in comment template

you can get comments from each post by its id with $comments253 = get_comments(‘post_id=253’); $comments724 = get_comments(‘post_id=724’); $comments798 = get_comments(‘post_id=798’); then merge ( array-merge ) and sort the array by date ( comment->comment_date being the key to the date value) if you want. then just foreach($comments as $comment) : echo($comment->comment_author . ‘<br />’ . $comment->comment_content); … Read more

How to add filter in “Comments” at the admin panel?

Working Example [Update] From this Answer, by @TheDeadMedic, here’s an adaptation to show only comments from a specific post_id. A link to this action is inserted in the status row. Hello World is the post with ID 53. When clicked it displays only the comments of that post in the URL example.com/wp-admin/edit-comments.php?comment_status=all&hello_world=1: add_action( ‘current_screen’, ‘wpse_72210_comments_exclude_lazy_hook’, … Read more

Success message in comment form

Without Ajax or plugins. Add to function.php: add_action( ‘set_comment_cookies’, function( $comment, $user ) { setcookie( ‘ta_comment_wait_approval’, ‘1’ ); }, 10, 2 ); add_action( ‘init’, function() { if( $_COOKIE[‘ta_comment_wait_approval’] === ‘1’ ) { setcookie( ‘ta_comment_wait_approval’, null, time() – 3600, “https://wordpress.stackexchange.com/” ); add_action( ‘comment_form_before’, function() { echo “<p id=’wait_approval’ style=”padding-top: 40px;”><strong>Your comment has been sent successfully.</strong></p>”; }); … Read more