钩子文档

submitpost_box

💡 云策文档标注

概述

submitpost_box 是一个 WordPress 钩子,在输出所有非 'page' 文章类型的 'side' 上下文元框之前触发。它主要用于在提交文章时执行自定义操作。

关键要点

  • 触发时机:在输出 'side' 上下文元框之前,适用于所有非 'page' 文章类型。
  • 参数:接受一个 WP_Post 对象作为参数,表示当前文章。
  • 钩子类型:这是一个动作钩子,使用 do_action 调用。
  • 版本历史:自 WordPress 2.5.0 版本引入。

代码示例

do_action( 'submitpost_box', $post );

📄 原文内容

Fires before meta boxes with ‘side’ context are output for all post types other than ‘page’.

Description

The submitpost box is a meta box with ‘side’ context, so this hook fires just before it is output.

Parameters

$postWP_Post
Post object.

Source

do_action( 'submitpost_box', $post );

Changelog

Version Description
2.5.0 Introduced.