remove_permastruct()
云策文档标注
概述
remove_permastruct() 函数用于移除通过 add_permastruct() 添加的自定义固定链接结构,内置的固定链接结构无法被移除。
关键要点
- 只能移除通过 add_permastruct() 添加的固定链接结构,内置结构不可移除
- 参数 $name 为必需,指定要移除的固定链接结构的名称
- 内部调用 WP_Rewrite::remove_permastruct() 方法实现功能
- 相关函数包括 WP_Taxonomy::remove_rewrite_rules() 和 WP_Post_Type::remove_rewrite_rules()
- 自 WordPress 4.5.0 版本引入
原文内容
Removes a permalink structure.
Description
Can only be used to remove permastructs that were added using add_permastruct() .
Built-in permastructs cannot be removed.
See also
Parameters
$namestringrequired-
Name for permalink structure.
Source
function remove_permastruct( $name ) {
global $wp_rewrite;
$wp_rewrite->remove_permastruct( $name );
}
Changelog
| Version | Description |
|---|---|
| 4.5.0 | Introduced. |