default_page_template_title
云策文档标注
概述
default_page_template_title 是一个 WordPress 过滤器钩子,用于修改下拉菜单中显示的默认页面模板标题。它允许开发者自定义标题文本和根据上下文调整显示。
关键要点
- 过滤器钩子:default_page_template_title
- 参数:$label(默认标题字符串)和 $context(显示上下文,如 'meta-box' 或 'quick-edit')
- 用途:自定义默认页面模板在下拉菜单中的显示标题
代码示例
add_filter( 'default_page_template_title', 'filter_function_name', 10, 2 );
function filter_function_name( $label, $context ) {
return __( 'Custom Page Template Title', 'textdomain' );
}
原文内容
Filters the title of the default page template displayed in the drop-down.
Parameters
$labelstring-
The display value for the default page template title.
$contextstring-
Where the option label is displayed. Possible values include
'meta-box'or'quick-edit'.
Source
$default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'meta-box' );
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |
Skip to note 2 content
Steven Lin
Example migrated from Codex:
Modify the title of the default page template displayed in the drop-down.
add_filter( 'default_page_template_title', 'filter_function_name', 10, 2 ); function filter_function_name( $label, $context ) { return __( 'Custom Page Template Title', 'textdomain' ); }