old_slug_redirect_post_id
云策文档标注
概述
本文档介绍了 WordPress 中的 old_slug_redirect_post_id 过滤器,用于在旧 slug 重定向时修改重定向的帖子 ID。该过滤器允许开发者自定义重定向逻辑,确保链接正确指向。
关键要点
- old_slug_redirect_post_id 是一个过滤器,用于修改旧 slug 重定向时的帖子 ID。
- 参数 $id 是整数类型,表示重定向的帖子 ID。
- 该过滤器在 wp_old_slug_redirect() 函数中使用,位于 wp-includes/query.php 文件中。
- 从 WordPress 4.9.3 版本开始引入。
原文内容
Filters the old slug redirect post ID.
Parameters
$idint-
The redirect post ID.
Source
$id = apply_filters( 'old_slug_redirect_post_id', $id );
Changelog
| Version | Description |
|---|---|
| 4.9.3 | Introduced. |