Skip to content

Fix nested comment reply link broken by replytocom hijacking#597

Draft
pfefferle wants to merge 5 commits intomainfrom
fix/487-nested-reply-link-v2
Draft

Fix nested comment reply link broken by replytocom hijacking#597
pfefferle wants to merge 5 commits intomainfrom
fix/487-nested-reply-link-v2

Conversation

@pfefferle
Copy link
Copy Markdown
Owner

Summary

  • Fixes the Reply link on nested comments being broken when the Webmention plugin is active (Webmention 'breaks' nested comments 'Reply' link #487)
  • The plugin was hijacking WordPress core's replytocom query parameter (used for threaded comment reply links) to serve a custom webmention comment template, which replaced the normal page and broke reply functionality
  • Introduces a new webmention_comment query parameter for webmention source URLs, leaving replytocom for WordPress core's threaded comment handling
  • The receiver maintains backward compatibility by accepting both webmention_comment and replytocom when parsing incoming webmention target URLs

Changes

  • includes/class-comment.php: Changed template_include filter to only trigger on webmention_comment (not replytocom); registered webmention_comment as the query var instead of replytocom
  • includes/class-sender.php: Sends webmentions with webmention_comment parameter instead of replytocom
  • includes/class-receiver.php: Checks webmention_comment first, falls back to replytocom for backward compatibility
  • templates/comment.php: Reads comment ID from either query var

Test plan

  • Activate the Webmention plugin on a site with threaded comments enabled
  • Click "Reply" on a nested comment and verify the comment form moves below it with "Leave a comment to [name]"
  • Submit a threaded reply and verify it nests correctly under the parent comment
  • Verify webmention sending still works for threaded comments (source URL now uses ?webmention_comment=ID)
  • Verify incoming webmentions with the old ?replytocom=ID format still set the correct comment parent

Fixes #487

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
@pfefferle pfefferle marked this pull request as draft March 30, 2026 18:05
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webmention 'breaks' nested comments 'Reply' link

1 participant