【发布时间】:2017-06-06 21:16:19
【问题描述】:
这是我的自定义帖子类型代码,我想给订阅者用户添加、编辑、删除权限。
如何在 wordpress 中允许订阅者用户自定义帖子类型(添加、编辑、删除)。请帮助我提前谢谢。
add_action( 'init', 'realestate_init' );
function realestate_init() {
$labels = array(
'name' => _x( 'Realestates', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'Realestate', 'post type singular name', 'your-plugin-textdomain' ),
'menu_name' => _x( 'Realestates', 'admin menu', 'your-plugin-textdomain' ),
'name_admin_bar' => _x( 'Realestate', 'add new on admin bar', 'your-plugin-textdomain' ),
'add_new' => _x( 'Add New', 'realestate', 'your-plugin-textdomain' ),
'add_new_item' => __( 'Add New Realestate', 'your-plugin-textdomain' ),
'new_item' => __( 'New Realestate', 'your-plugin-textdomain' ),
'edit_item' => __( 'Edit Realestate', 'your-plugin-textdomain' ),
'view_item' => __( 'View Realestate', 'your-plugin-textdomain' ),
'all_items' => __( 'All Realestates', 'your-plugin-textdomain' ),
'search_items' => __( 'Search Realestates', 'your-plugin-textdomain' ),
'parent_item_colon' => __( 'Parent Realestates:', 'your-plugin-textdomain' ),
'not_found' => __( 'No realestates found.', 'your-plugin-textdomain' ),
'not_found_in_trash' => __( 'No realestates found in Trash.', 'your-plugin-textdomain' )
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.', 'your-plugin-textdomain' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'realestate' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'realestate', $args );
}
// End register custom post type
【问题讨论】:
标签: wordpress custom-post-type