term_updated_messages
云策文档标注
概述
term_updated_messages 是一个 WordPress 过滤器,用于自定义在标签或分类法术语更新时显示的消息。它允许开发者修改或添加特定分类法的更新消息数组。
关键要点
- 过滤器名称:term_updated_messages
- 参数:$messages,一个数组,键为分类法名称,值为消息数组
- 用途:过滤标签更新时显示的消息,支持自定义分类法
- 引入版本:WordPress 3.7.0
代码示例
function wpdocs_updated_messages( $messages ) {
$messages['wpdocs_taxonomy'] = array(
0 => '',
1 => __( 'Term added.' ),
2 => __( 'Term deleted.' ),
3 => __( 'Term updated.' ),
4 => __( 'Term not added.' ),
5 => __( 'Term not updated.' ),
6 => __( 'Terms deleted.' ),
);
return $messages;
}
add_filter( 'term_updated_messages', 'wpdocs_updated_messages' );
原文内容
Filters the messages displayed when a tag is updated.
Parameters
$messagesarray[]-
Array of arrays of messages to be displayed, keyed by taxonomy name.
Source
$messages = apply_filters( 'term_updated_messages', $messages );
Changelog
| Version | Description |
|---|---|
| 3.7.0 | Introduced. |
Skip to note 2 content
d79
Custom messages for when a term of a custom taxonomy is updated:
function wpdocs_updated_messages( $messages ) { $messages['wpdocs_taxonomy'] = array( 0 => '', 1 => __( 'Term added.' ), 2 => __( 'Term deleted.' ), 3 => __( 'Term updated.' ), 4 => __( 'Term not added.' ), 5 => __( 'Term not updated.' ), 6 => __( 'Terms deleted.' ), ); return $messages; } add_filter( 'term_updated_messages', 'wpdocs_updated_messages' );