Make WordPress Core

Opened 8 years ago

Last modified 4 years ago

#38925 new enhancement

Allow override of depth limits on comment reply link

Reported by: travisr's profile TravisR Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Comments Keywords: has-patch dev-feedback has-unit-tests needs-refresh
Focuses: Cc:


The core code currently hides the Reply link if a comment is at the maxDepth setting for comment nesting, but this appears to only be a constraint on the presentation. The API still allows replies through URL parameters and the REST interface, which demonstrates that there is not a functional reason for the constraint.

I'm proposing that plugin authors are allowed to override this constraint by setting $args['limit_by_depth'] = false in a comment_reply_link_args filter. This requires only a minor, inconsequential change to comment-template.php per the attached patch.

Note the 'Infinite Comment Replies' plugin currently achieves this by completely rewriting the reply link and thus masking everything that is handled in the core production of the link. The proposal above is a better option to achieve the same effect.

Attachments (2)

0001-Support-override-of-depth-constraint-on-reply-link.patch (1.5 KB) - added by TravisR 8 years ago.
git patch for the change
38925.2.patch (7.9 KB) - added by birgire 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @TravisR
8 years ago

  • Keywords has-patch added

#2 @TravisR
8 years ago

  • Keywords dev-feedback added

7 years ago

#3 @birgire
7 years ago

  • Keywords has-unit-tests added

Thank you for the patch @TravisR

I remember looking into workarounds previously here:

so I was planning to create a ticket for this, when I found this one ;-)

When writing the tests I noticed that the comment validation was missing, so I created another ticket #41846 for that.

The patch in 0001-Support-override-of-depth-constraint-on-reply-link.patch broke the two existing tests in Tests_Comment_GetCommentReplyLink, because of the missing the comment validation in get_comment_reply_link().

I included the comment validation in 38925.2.patch and rearranged it a little bit from the previous patch.

In 38925.2.patch I updated the 0001-Support-override-of-depth-constraint-on-reply-link.patch to the current version, with documentation and few tests.

I'm wondering about the name of the limit_by_depth argument, if it could better describe it's purpose? Maybe as hide_below_max_depth, max_depth_hidden, show_only_above_max_depth .... But I'm not sure ;-)

#4 @TravisR
7 years ago

Thanks for picking this up. I'm not a regular Wordpress contributor so I'm happy to let you run with it, and I don't have any concerns with the updates you've made. As for the variable name, I think 'show_only_above_max_depth' is probably the best of the proposed options. I'll just be happy if you can get this into a release so I don't have to keep modifying the core every time I upgrade.

#5 @birgire
7 years ago


I'm not a core committer, so it's not up to me to add it to the current release ;-)

but by adding tests and inline documentation, we can increase the change.

yes show_only_above_max_depth describes it nicely, but it's rather long ;-)

You could try to look at my filter example, in one of the links above, to avoid updating the core each time.

#6 @andraganescu
5 years ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

Howdy @birgire this patch apparently does not apply cleanly with the core grunt tool. Would you like to give it another go and refresh it? I still believe the change, albeit minor, is good to go.

Thank you!

#7 @LeSpark
4 years ago

So this is the reason, while nested comments on the lowest level have no reply button?

If yes, i'd really appreciate a fix.

Version 0, edited 4 years ago by LeSpark (next)
Note: See TracTickets for help on using tickets.