wp_unique_post_slug
云策文档标注
概述
wp_unique_post_slug 是一个 WordPress 过滤器,用于修改或自定义文章的唯一 slug。它允许开发者在 slug 生成过程中介入,基于文章 ID、状态、类型等参数进行调整。
关键要点
- 过滤器名称:wp_unique_post_slug
- 参数包括:$slug(slug 字符串)、$post_id(文章 ID)、$post_status(文章状态)、$post_type(文章类型)、$post_parent(父文章 ID)、$original_slug(原始 slug)
- 相关函数:wp_unique_post_slug() 用于计算唯一 slug
- 引入版本:WordPress 3.3.0
原文内容
Filters the unique post slug.
Parameters
$slugstring-
The post slug.
$post_idint-
Post ID.
$post_statusstring-
The post status.
$post_typestring-
Post type.
$post_parentint-
Post parent ID
$original_slugstring-
The original post slug.
Source
return apply_filters( 'wp_unique_post_slug', $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug );
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |