钩子文档

post_comment_status_meta_box-options

💡 云策文档标注

概述

post_comment_status_meta_box-options 是一个 WordPress 动作钩子,在文章编辑屏幕的 Discussion 元框末尾触发,用于自定义评论状态选项。

关键要点

  • 这是一个动作钩子,允许开发者在文章编辑界面的 Discussion 元框末尾添加自定义功能。
  • 钩子传递一个参数:$post,即当前文章的 WP_Post 对象。
  • 钩子名称遵循 WordPress 命名规范,但使用了连字符而非下划线,需注意兼容性。
  • 首次引入于 WordPress 3.1.0 版本。

代码示例

do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

注意事项

  • 钩子名称 post_comment_status_meta_box-options 使用了连字符,不符合 WordPress 推荐的下划线命名约定,使用时需注意潜在问题。
  • 此钩子与 post_comment_status_meta_box() 函数相关,该函数用于显示评论状态表单字段。

📄 原文内容

Fires at the end of the Discussion meta box on the post editing screen.

Parameters

$postWP_Post
WP_Post object for the current post.

Source

do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

Changelog

Version Description
3.1.0 Introduced.