4

Is there a way to allow the reply link to remain on the comment form after I have reached my 10 nested comment limit?

I don't necessarily need nested comments I just need the reply link to be always available as I'm using a plugin that only sends out email notifications on a comment "reply".

3

If you need to modify the max depth, you could use the thread_comments_depth_max filter:

/**
 * Set max comments depth to 15 on the discussion settings page
 */
add_filter( 'thread_comments_depth_max', function( $max )
{
    return 15;
} );

then the dropdown on the discussion settings page will show the range 1 - 15.

But I can imagine very deep comment threads would be harder to read.

Another approach would be to override the thread_comments_depth option value on the front-end:

/**
 * Set max comments depth to 15 on the front-end
 */
add_filter( 'option_thread_comments_depth', function( $val )
{
    if( ! is_admin() )
        $val = 15;

    return $val;
} );

The reason why the reply links don't show for depths greater than the max depth is this part:

if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
    return;
}

within the get_comment_reply_link() function.

It's not possible to use the comment_reply_link_args filter, because it's applied after the depth check, for some reason.

  • "But I can imagine very deep comment threads would be harder to read."... couldn't that be solved with un-nested css styling? – Pete Jan 25 '16 at 11:31
  • yes, that css might be a workaround. If the comment_reply_link_args would be above the depth check, then I think we could have a more dynamic depth and even change the max_depth per comment. @Pete – birgire Jan 25 '16 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.