钩子文档

pre_term_link

💡 云策文档标注

概述

pre_term_link 是一个 WordPress 过滤器,用于在术语链接的令牌替换发生前修改其固定链接结构。它允许开发者在生成分类法术语归档链接时自定义链接格式。

关键要点

  • 过滤器名称:pre_term_link
  • 参数:$termlink(术语固定链接结构字符串)和 $term(WP_Term 对象)
  • 调用位置:在 get_term_link() 函数中,位于 wp-includes/taxonomy.php 文件
  • 引入版本:WordPress 4.9.0

📄 原文内容

Filters the permalink structure for a term before token replacement occurs.

Parameters

$termlinkstring
The permalink structure for the term’s taxonomy.
$termWP_Term
The term object.

Source

$termlink = apply_filters( 'pre_term_link', $termlink, $term );

Changelog

Version Description
4.9.0 Introduced.