钩子文档

{$taxonomy}_term_edit_form_top

💡 云策文档标注

概述

此 Hook 在编辑分类法术语表单的顶部触发,用于在表单开始处添加自定义内容。动态部分 $taxonomy 允许针对特定分类法定制 Hook 名称。

关键要点

  • 触发时机:在编辑分类法术语表单的顶部,隐藏字段和 nonces 已输出后。
  • 动态 Hook 名称:基于 $taxonomy 参数,例如 category_term_edit_form_top 或 post_tag_term_edit_form_top。
  • 参数:$tag(WP_Term 对象,当前术语)和 $taxonomy(字符串,当前分类法 slug)。
  • 引入版本:WordPress 4.5.0。

代码示例

do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy );

📄 原文内容

Fires at the beginning of the Edit Term form.

Description

At this point, the required hidden fields and nonces have already been output.

The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.

Possible hook names include:

  • category_term_edit_form_top
  • post_tag_term_edit_form_top

Parameters

$tagWP_Term
Current taxonomy term object.
$taxonomystring
Current $taxonomy slug.

Source

do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy );

Changelog

Version Description
4.5.0 Introduced.