Is there a hook to update / replace values in the “Enable threaded (nested) comments x levels deep” drop down?
Yes, there is, and it’s named thread_comments_depth_max: add_filter( ‘thread_comments_depth_max’, function ( $maxdeep ) { return 15; } );
Yes, there is, and it’s named thread_comments_depth_max: add_filter( ‘thread_comments_depth_max’, function ( $maxdeep ) { return 15; } );
You can manually adjust this number using the following method. function adjust_wp_comments_count( $original_counts ) { $counts = new \stdClass(); $counts->moderated = 99; return $counts; } add_filter( ‘wp_count_comments’, ‘adjust_wp_comments_count’, 100, 1 ); The line: $counts->moderated = 99 is what you will need to adjust if you want to set it to a particular value or calculation … Read more
I believe the below should do the trick, just add to your functions.php file. /** * Prevent non-administrator users from viewing others comments. */ add_filter( ‘comments_list_table_query_args’, function( $args ) { global $pagenow; if ( $pagenow == ‘edit-comments.php’ ) { $user = wp_get_current_user(); $value = !empty( $args[ ‘author__in’ ] ) ? $args[ ‘author__in’ ] : []; … Read more
This should do the trick… <?php $number_of_parents = comment_counter($post->ID); $number_of_children = $post->comment_count – $number_of_parents; ?> <?php if ( have_comments() ): ?> <h3 class=”comments-title”>Discussion: <?php if ( $number_of_children > 0 ): ?> <?php echo implode( ‘ ‘, [ printf( _n( ‘%d question’, ‘%d questions’, $number_of_parents ), $number_of_parents ), __( ‘and’ ), printf( _n( ‘%d answer’, ‘%d … Read more
As said in this comment, WordPress has some possibilities to moderate comments and some good plugins for spam prevention. Nevertheless, if I understand you correctly you would like to prevent the post of comments before it gets to the database. I think I’ve found a solution for that. Check out the code for your functions.php. … Read more
@JacobPeattie Forget my last answers. You are absolutely right, Antispam Bee was the cause. I didn’t install it on the second site. After installing it, I also have there now an obfuscated name. Thanks so much for your help! I should have seen this myself. Thanks for the great support here – with your help … Read more
You can use the pre_get_comments filter to modify the parameters of the comment query before it fetches the comments. Specifically the author_in parameter. I tried to write an example, though I haven’t tested it, but it would be similar to this: add_action( ‘pre_get_comments’, ‘author_and_self_comment_filter’ ); function author_and_self_filter( \WP_Comment_Query $query ) : void { // We … Read more
There’s a filter, wp_count_comments, that might do what you need: add_filter( ‘wp_count_comments’, ‘wpse_404619_maybe_disable_comments’, 10, 2 ); /** * Disables comments on certain pages. * * @param array $comments The page’s comments. * @param int $post_id The page’s post_ID. * @return array The filtered comments; empty array to disable. */ function wpse_404619_maybe_disable_comments( $comments, $post_id ) { … Read more
What you get is fine, it’s the image id, now you just need to loop them and output the structure that you want, for example. if (!empty($images = get_comment_meta( $comment->comment_ID , ‘reviews-images’, true ))) { foreach ($images as $image_id) { $image_src = wp_get_attachment_image_src($image_id, ‘full’); // Now you have the image src, $image_src, you can do … Read more
As I see you are using reCaptcha v3 as the examples you try and it will not appear until the user score is under the minimum you added into the configuration but it is still working and checking the user score before he submits your form. anyway if you configured the plugin correctly you may … Read more