admin管理员组文章数量:1289581
I created custom-post-type.php file in folder of mu-plugins:
<?php
function custom_post_types(){
register_post_type('event', array(
'public' => true,
'labels' => array(
'name' => 'Events',
'edit_item'=>'Edit Event',
'edit_posts' => 'Add New Event',
'all_items' => 'All Events'
),
'menu_icon' => 'dashicons-calendar'
));
}
add_action('init', 'custom_post_types');
These two labels name of 'edit_item'=> 'Edit Event', & 'edit_posts' => 'Add New Event'
not working. I wanted to know where i am mistaken. Can somebody help? Thank you!
I created custom-post-type.php file in folder of mu-plugins:
<?php
function custom_post_types(){
register_post_type('event', array(
'public' => true,
'labels' => array(
'name' => 'Events',
'edit_item'=>'Edit Event',
'edit_posts' => 'Add New Event',
'all_items' => 'All Events'
),
'menu_icon' => 'dashicons-calendar'
));
}
add_action('init', 'custom_post_types');
These two labels name of 'edit_item'=> 'Edit Event', & 'edit_posts' => 'Add New Event'
not working. I wanted to know where i am mistaken. Can somebody help? Thank you!
1 Answer
Reset to default 2- You have put these labels inside the
capabilities
argument, which is incorrect. They should be inlabels
argument. - There is not
edit_posts
label, and you're missing most labels. There's many more labels you need to provide. They are listed here: https://developer.wordpress/reference/functions/get_post_type_labels/
本文标签: Custom Post type Labels are not showing
版权声明:本文标题:Custom Post type: Labels are not showing 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741418026a2377633.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论