钩子文档

saved_term

💡 云策文档标注

概述

saved_term 是一个 WordPress Hook,在术语保存且缓存清除后触发,用于执行相关操作。

关键要点

  • 触发时机:术语保存后,缓存已清除时
  • 特定 Hook:'saved_$taxonomy' 可用于针对特定分类法
  • 参数:$term_id(术语ID)、$tt_id(术语分类法ID)、$taxonomy(分类法slug)、$update(是否更新)、$args(wp_insert_term() 参数)
  • 相关函数:wp_update_term() 和 wp_insert_term()
  • 版本变化:6.1.0 添加 $args 参数,5.5.0 引入

代码示例

do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false, $args );

📄 原文内容

Fires after a term has been saved, and the term cache has been cleared.

Description

The ‘saved_$taxonomy’ hook is also available for targeting a specific taxonomy.

Parameters

$term_idint
Term ID.
$tt_idint
Term taxonomy ID.
$taxonomystring
Taxonomy slug.
$updatebool
Whether this is an existing term being updated.
$argsarray
Arguments passed to wp_insert_term() .

More Arguments from wp_insert_term( … $args )

Array or query string of arguments for inserting a term.

  • alias_of string
    Slug of the term to make this term an alias of.
    Accepts a term slug.
  • description string
    The term description.
  • parent int
    The id of the parent term. Default 0.
  • slug string
    The term slug to use.

Source

do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false, $args );

Changelog

Version Description
6.1.0 The $args parameter was added.
5.5.0 Introduced.