redirect_post_location
云策文档标注
概述
redirect_post_location 是一个 WordPress 过滤器,用于修改文章发布或更新后的重定向目标 URL。它允许开发者在重定向发生前自定义 URL。
关键要点
- 过滤器名称:redirect_post_location
- 参数:$location(目标 URL 字符串)和 $post_id(文章 ID)
- 应用场景:在 wp_redirect() 函数中调用,用于文章发布或更新后的重定向
- 相关函数:redirect_post(),位于 wp-admin/includes/post.php
- 引入版本:WordPress 2.9.0
原文内容
Filters the post redirect destination URL.
Parameters
$locationstring-
The destination URL.
$post_idint-
The post ID.
Source
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |