钩子文档

comment_form_logged_in_after

💡 云策文档标注

概述

comment_form_logged_in_after 是一个 WordPress Hook,在评论表单中 is_user_logged_in() 检查后触发,用于在用户登录状态下执行自定义操作。

关键要点

  • 触发时机:在 comment_form() 函数中,当 is_user_logged_in() 检查确认用户已登录后立即执行。
  • 参数:$commenter(数组,包含评论者的用户名、邮箱和URL)和 $user_identity(字符串,如果评论者是注册用户则为显示名称,否则为空)。
  • 用途:允许开发者在用户登录后的评论表单部分添加自定义功能,如显示额外信息或修改表单元素。
  • 相关函数:与 comment_form() 函数关联,用于输出评论表单模板。
  • 版本历史:自 WordPress 3.0.0 版本引入。

📄 原文内容

Fires after the is_user_logged_in() check in the comment form.

Parameters

$commenterarray
An array containing the comment author’s username, email, and URL.
$user_identitystring
If the commenter is a registered user, the display name, blank otherwise.

Source

do_action( 'comment_form_logged_in_after', $commenter, $user_identity );

Changelog

Version Description
3.0.0 Introduced.