当我添加或编辑注册为register_post_type()函数的自定义帖子类型时,如何自定义显示的通知消息(“发布的帖子”或“更新的帖子”)?
发布于 2021-02-09 14:25:17
由于Wordpress 5.0,您现在可以直接在register_post_type函数中定义这些消息:
function wporg_custom_post_type() {
register_post_type('wporg_product',
array(
'labels' => array(
'name' => __('Products', 'textdomain'),
'singular_name' => __('Product', 'textdomain'),
'item_published' => __( 'Product published.', 'textdomain' ), // new since WP 5.0
'item_published_privately' => __( 'Product published privately.', 'textdomain' ), // new since WP 5.0
'item_reverted_to_draft' => __( 'Product reverted to draft.', 'textdomain' ), // new since WP 5.0
'item_scheduled' => __( 'Product scheduled.', 'textdomain' ), // new since WP 5.0
'item_updated' => __( 'Product updated.', 'textdomain' ), // new since WP 5.0
),
'public' => true,
'has_archive' => true,
)
);
}
add_action('init', 'wporg_custom_post_type');来源:https://make.wordpress.org/core/2018/12/05/new-post-type-labels-in-5-0/
https://wordpress.stackexchange.com/questions/268379
复制相似问题