钩子文档

strict_redirect_guess_404_permalink

💡 云策文档标注

概述

strict_redirect_guess_404_permalink 是一个 WordPress 过滤器,用于控制 404 重定向时的猜测行为。当返回真值时,仅重定向到完全匹配 post_name 的页面。

关键要点

  • 过滤器名称:strict_redirect_guess_404_permalink
  • 参数:$strict_guess(布尔值,默认 false,表示宽松猜测)
  • 用途:影响 redirect_guess_404_permalink() 函数的行为,决定是否仅重定向到精确匹配的页面
  • 引入版本:WordPress 5.5.0

代码示例

$strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false );

📄 原文内容

Filters whether to perform a strict guess for a 404 redirect.

Description

Returning a truthy value from the filter will redirect only exact post_name matches.

Parameters

$strict_guessbool
Whether to perform a strict guess. Default false (loose guess).

Source

$strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false );

Changelog

Version Description
5.5.0 Introduced.