钩子文档

comment_id_not_found

💡 云策文档标注

概述

comment_id_not_found 是一个 WordPress Hook,当尝试对不存在的文章提交评论时触发。它主要用于处理评论提交过程中的错误情况。

关键要点

  • 触发时机:当评论尝试提交给一个不存在的文章时
  • 参数:$comment_post_id(整数类型,表示文章 ID)
  • 相关函数:wp_handle_comment_submission() 使用此 Hook 来处理评论提交
  • 版本历史:自 WordPress 1.5.0 版本引入

📄 原文内容

Fires when a comment is attempted on a post that does not exist.

Parameters

$comment_post_idint
Post ID.

Source

do_action( 'comment_id_not_found', $comment_post_id );

Changelog

Version Description
1.5.0 Introduced.