Skip to content

Comments

Fix comment type check missing empty string in email formatting#177

Open
jdevalk wants to merge 4 commits intodevelopfrom
fix/comment-type-comparison
Open

Fix comment type check missing empty string in email formatting#177
jdevalk wants to merge 4 commits intodevelopfrom
fix/comment-type-comparison

Conversation

@jdevalk
Copy link
Member

@jdevalk jdevalk commented Feb 5, 2026

Summary

  • WordPress stores comment_type as either '' (empty string) or 'comment' for regular comments
  • The === 'comment' strict comparison in add_author_line() and add_content_line() missed the empty string case
  • Regular comments with empty comment_type were formatted as pingbacks/trackbacks in notification emails (showing "Website:" instead of "Author:" and "Excerpt:" instead of "Comment:")
  • Fixed by checking against known non-comment types (pingback/trackback) instead, matching the approach used in the switch statements elsewhere in the same class

Test plan

  • Submit a regular comment and verify the notification email shows "Author:" and "Comment:" labels
  • Submit/receive a pingback and verify the email shows "Website:" and "Excerpt:" labels

🤖 Generated with Claude Code

WordPress stores regular comments with comment_type as either empty
string or 'comment'. The strict === 'comment' check missed empty
strings, causing regular comments to be formatted as pingbacks/trackbacks
in notification emails. Now checks against known non-comment types instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Test on Playground
Test this pull request on the Playground
or download the zip

@jdevalk jdevalk requested a review from aristath February 5, 2026 11:06
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
1 0 1

⚠️ Warnings (1)

📁 comment-hacks.php (1 warning)
📍 Line 🔖 Check 💬 Message
0 textdomain_mismatch The "Text Domain" header in the plugin file does not match the slug. Found "yoast-comment-hacks", expected "comment-hacks".

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

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.

2 participants