钩子文档

redirect_term_location

💡 云策文档标注

概述

redirect_term_location 是一个 WordPress 过滤器钩子,用于修改分类法重定向的目标 URL。它允许开发者在分类法重定向时自定义或调整重定向位置。

关键要点

  • 这是一个过滤器钩子,用于过滤分类法重定向的目标 URL。
  • 接受两个参数:$location(目标 URL 字符串)和 $tax(WP_Taxonomy 对象)。
  • 在 wp_redirect() 函数中调用,通过 apply_filters 应用。
  • 自 WordPress 4.6.0 版本引入。

📄 原文内容

Filters the taxonomy redirect destination URL.

Parameters

$locationstring
The destination URL.
$taxWP_Taxonomy
The taxonomy object.

Source

wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );

Changelog

Version Description
4.6.0 Introduced.