wp_unique_post_slug_is_bad_flat_slug
云策文档标注
概述
本文档介绍了 wp_unique_post_slug_is_bad_flat_slug 过滤器,用于判断文章别名是否不适合作为扁平化别名。该过滤器在 wp_unique_post_slug() 函数中被调用,允许开发者自定义别名检查逻辑。
关键要点
- 过滤器名称:wp_unique_post_slug_is_bad_flat_slug
- 用途:过滤文章别名是否被视为坏的扁平化别名
- 参数:$bad_slug(布尔值,表示别名是否坏)、$slug(字符串,文章别名)、$post_type(字符串,文章类型)
- 调用方式:apply_filters('wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type)
- 相关函数:wp_unique_post_slug(),用于计算文章的唯一别名
- 引入版本:WordPress 3.1.0
原文内容
Filters whether the post slug would be bad as a flat slug.
Parameters
$bad_slugbool-
Whether the post slug would be bad as a flat slug.
$slugstring-
The post slug.
$post_typestring-
Post type.
Source
$is_bad_flat_slug = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |