首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何自定义编辑通知

如何自定义编辑通知
EN

WordPress Development用户
提问于 2017-05-28 11:58:51
回答 1查看 922关注 0票数 4

当我添加或编辑注册为register_post_type()函数的自定义帖子类型时,如何自定义显示的通知消息(“发布的帖子”或“更新的帖子”)?

EN

回答 1

WordPress Development用户

发布于 2021-02-09 14:25:17

由于Wordpress 5.0,您现在可以直接在register_post_type函数中定义这些消息:

代码语言:javascript
复制
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/

票数 2
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/268379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档