-
Notifications
You must be signed in to change notification settings - Fork 0
Hooks
Everything the plugin exposes. All names are prefixed happy_comments_.
| Filter | Purpose |
|---|---|
happy_comments_show_comment_form_field |
bool $enabled, int $post_id — hide the checkbox, per post |
happy_comments_comment_form_label |
string $label — the checkbox text |
happy_comments_comment_form_precheck |
bool $checked — whether it starts ticked |
happy_comments_subscription_scope |
string $scope — all or replies
|
happy_comments_comment_form_field |
string $html, bool $checked, int $post_id — the whole field markup |
happy_comments_subscribe_form |
string $html, int $post_id — the standalone form markup |
happy_comments_subscribe_form_available |
bool $available, int $post_id — defaults to comments_open()
|
happy_comments_subscribe_response |
string $message — shown after any submission. Keep it outcome-independent |
happy_comments_moderation_note |
string $note — the sentence added to the moderation notice. Empty removes it |
| Filter | Purpose |
|---|---|
happy_comments_mail_subject |
string $subject, string $type, array $vars |
happy_comments_mail_body_html |
string $body, string $type, array $vars |
happy_comments_mail_body_text |
string $body, string $type, array $vars |
happy_comments_mail_headers |
array $headers, string $type, array $vars |
happy_comments_from_name |
string $name — defaults to the site name |
happy_comments_from_address |
string $address — defaults to wordpress@yourdomain
|
happy_comments_unsubscribe_mailto |
string $address, int $subscription_id — off by default |
happy_comments_confirmation_lifetime |
int $seconds — default 172800 (48 hours) |
happy_comments_send_after_response |
bool $can_send — send at the end of the request rather than by cron |
$type is confirmation or notification.
Setting a mailto: unsubscribe target is a promise that somebody reads that mailbox and acts on it. If nobody does, a reader who clicks unsubscribe in Apple Mail believes they have opted out while staying subscribed. Only enable it if monitoring that mailbox is a process rather than an intention.
| Filter | Purpose |
|---|---|
happy_comments_notify_whole_subthread |
bool $whole — true notifies on the whole subthread, false on direct replies only |
happy_comments_max_comment_age |
int $seconds — older comments are treated as imported. Default 86400 |
happy_comments_request_limit |
int $limit — comments queued per request. Default 100 |
happy_comments_retention_days |
int $days — how long unconfirmed rows are kept |
happy_comments_throttle_limit |
int $value, string $name — min_interval, max_age, ip_limit, address_cooldown
|
| Filter | Purpose |
|---|---|
happy_comments_consent_ip |
string $truncated, string $full — return $full to store the whole address, '' to store none |
happy_comments_privacy_url |
string $url |
happy_comments_privacy_label |
string $label |
| Filter | Purpose |
|---|---|
happy_comments_admin_capability |
string $capability — defaults to manage_options
|
happy_comments_endpoint_page |
string $body, string $title — the confirm and unsubscribe pages |
The capability is manage_options rather than moderate_comments on purpose. Comment moderation is often delegated to editors, and this screen lists every subscriber's address alongside their consent record.
| Action | Fires |
|---|---|
happy_comments_init |
once the plugin has registered its hooks |
happy_comments_activate |
on activation |
happy_comments_deactivate |
on deactivation |
happy_comments_unsubscribed |
int $id — after an unsubscribe |
happy_comments_status_changed |
int $id, string $new, string $previous |
happy_comments_deleted_subscriptions |
array $ids, int $deleted |
happy_comments_confirmation_failed |
int $id — wp_mail() refused the message |
happy_comments_purged_unconfirmed |
int $deleted, string $cutoff |
happy_comments_purged_post |
int $post_id, int $deleted |
Send from an address your provider has verified:
add_filter( 'happy_comments_from_address', fn() => 'hello@example.com' );
add_filter( 'happy_comments_from_name', fn() => 'Example' );Notify only on direct replies:
add_filter( 'happy_comments_notify_whole_subthread', '__return_false' );Store no IP addresses at all:
add_filter( 'happy_comments_consent_ip', '__return_empty_string' );Log confirmations that could not be sent:
add_action( 'happy_comments_confirmation_failed', function ( $id ) {
error_log( 'Happy Comments: confirmation ' . $id . ' failed to send' );
} );