Fix nested comment reply link broken by replytocom hijacking#597
Draft
Fix nested comment reply link broken by replytocom hijacking#597
Conversation
The Webmention plugin registered "replytocom" as a WordPress query var and hijacked the template_include filter to serve a custom comment template whenever that parameter was present. This conflicted with WordPress core's threaded comment reply functionality, which uses "?replytocom=ID" as the fallback URL for reply links. The template override prevented the normal comment form from loading, breaking the "Reply" UI and comment nesting. The fix introduces a new "webmention_comment" query parameter for webmention source URLs, leaving WordPress core's "replytocom" parameter untouched. The receiver maintains backward compatibility by accepting both parameter names when parsing incoming webmention targets. Fixes #487
Align with the ActivityPub plugin's convention of using ?c= for comment source URLs.
Reset files to main and redo targeted changes: only replace the query parameter from replytocom to c, without touching function names like register_webmention_comment_type or filter names like webmention_comment_data.
Register both c and replytocom query vars and accept either in the template include check. New webmentions are sent with ?c= but existing ones using ?replytocom= continue to work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
replytocomquery parameter (used for threaded comment reply links) to serve a custom webmention comment template, which replaced the normal page and broke reply functionalitywebmention_commentquery parameter for webmention source URLs, leavingreplytocomfor WordPress core's threaded comment handlingwebmention_commentandreplytocomwhen parsing incoming webmention target URLsChanges
includes/class-comment.php: Changedtemplate_includefilter to only trigger onwebmention_comment(notreplytocom); registeredwebmention_commentas the query var instead ofreplytocomincludes/class-sender.php: Sends webmentions withwebmention_commentparameter instead ofreplytocomincludes/class-receiver.php: Checkswebmention_commentfirst, falls back toreplytocomfor backward compatibilitytemplates/comment.php: Reads comment ID from either query varTest plan
?webmention_comment=ID)?replytocom=IDformat still set the correct comment parentFixes #487