default_title
云策文档标注
概述
default_title 过滤器用于修改在“撰写文章”表单中初始显示的默认文章标题。它允许开发者在文章创建时自定义标题的默认值。
关键要点
- 过滤器名称:default_title
- 参数:$post_title(默认标题字符串)和 $post(WP_Post 对象)
- 应用场景:在 get_default_post_to_edit() 函数中调用,用于设置新文章的初始标题
- 版本历史:自 WordPress 1.5.0 版本引入
代码示例
$post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
原文内容
Filters the default post title initially used in the “Write Post” form.
Parameters
$post_titlestring-
Default post title.
$postWP_Post-
Post object.
Source
$post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |