如何仅在WordPress中显示自定义帖子
我是WordPress的新手,我创建了自定义帖子类型,我希望仅适用于订户(不适合管理员),那么我该怎么做是我当前的代码? 函数create_posttype(){
register_post_type( 'UserProject',
array(
'labels' => array(
'name' => __( 'UserProject' ),
'singular_name' => __( 'UserProject' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'UserProject'),
'show_in_rest' => true,
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
I am new in wordpress, i created custom post type and i want this should display only for subscriber only(not for admin ) So how can i do this Here is my current code?
function create_posttype() {
register_post_type( 'UserProject',
array(
'labels' => array(
'name' => __( 'UserProject' ),
'singular_name' => __( 'UserProject' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'UserProject'),
'show_in_rest' => true,
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
书是一种自定义帖子类型,您可以在此处编写自己的代码。
订户无权仪表板。您可以设置编辑规则或其他规则的条件。
Book is a custom post type you can write your own code here.
Subscribers have no rights to the dashboard. You can set the condition for editor rule or another rule.