WordPress自定义文章类型,带角色和大写

WordPress自定义文章类型,带角色和大写,wordpress,custom-post-type,Wordpress,Custom Post Type,我正在开发房地产网站使用WordPress自定义帖子类型,用户可以发布,编辑,删除自己的帖子只有。这是我的代码,但无法达到目标 function property_post_type() { $labels = array( 'name' => _x( 'Properties', 'Post Type General Name', 'text_domain' ), 'singular_name' =

我正在开发房地产网站使用WordPress自定义帖子类型,用户可以发布,编辑,删除自己的帖子只有。这是我的代码,但无法达到目标

function property_post_type() {

    $labels = array(
        'name'                  => _x( 'Properties', 'Post Type General Name', 'text_domain' ),
        'singular_name'         => _x( 'Property', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'             => __( 'Properties', 'text_domain' ),
        'name_admin_bar'        => __( 'Property', 'text_domain' ),
        'archives'              => __( 'Item Archives', 'text_domain' ),
        'attributes'            => __( 'Item Attributes', 'text_domain' ),
        'parent_item_colon'     => __( 'Parent Item:', 'text_domain' ),
        'all_items'             => __( 'All Property', 'text_domain' ),
        'add_new_item'          => __( 'Add New Property', 'text_domain' ),
        'add_new'               => __( 'Add New', 'text_domain' ),
        'new_item'              => __( 'New Item', 'text_domain' ),
        'edit_item'             => __( 'Edit Property', 'text_domain' ),
        'update_item'           => __( 'Update Item', 'text_domain' ),
        'view_item'             => __( 'View Item', 'text_domain' ),
        'view_items'            => __( 'View Items', 'text_domain' ),
        'search_items'          => __( 'Search Item', 'text_domain' ),
        'not_found'             => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'    => __( 'Not found in Trash', 'text_domain' ),
        'featured_image'        => __( 'Featured Image', 'text_domain' ),
        'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
        'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
        'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
        'insert_into_item'      => __( 'Insert into item', 'text_domain' ),
        'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
        'items_list'            => __( 'Items list', 'text_domain' ),
        'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
        'filter_items_list'     => __( 'Filter items list', 'text_domain' ),
    );
    $args = array(
        'label'                 => __( 'Property', 'text_domain' ),
        'description'           => __( 'Properties information page.', 'text_domain' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'thumbnail', 'revisions'),
        'taxonomies'            => array( 'region', 'city' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-admin-home',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,

        'capability_type' => array("property", "properties"),
      'map_meta_cap' => true,
    );
    register_post_type( 'property', $args );

}
add_action( 'init', 'property_post_type', 0 );

/****************************************
 * Add custom taxonomy for Property *
 ****************************************/

add_action('init', 'property_categories_register');


function property_categories_register() {
$labels = array(
    'name'                          => 'Category',
    'singular_name'                 => 'Property Category',
    'search_items'                  => 'Search Property Categories',
    'popular_items'                 => 'Popular Property Categories',
    'all_items'                     => 'All Properties Categories',
    'parent_item'                   => 'Parent Property Category',
    'edit_item'                     => 'Edit Property Category',
    'update_item'                   => 'Update Property Category',
    'add_new_item'                  => 'Add New Property Category',
    'new_item_name'                 => 'New Property Category',
    'separate_items_with_commas'    => 'Separate properties categories with commas',
    'add_or_remove_items'           => 'Add or remove properties categories',
    'choose_from_most_used'         => 'Choose from most used properties categories'
    );

$args = array(
    'label'                         => 'Property Categories',
    'labels'                        => $labels,
    'public'                        => false,
    'hierarchical'                  => true,
    'show_ui'                       => true,
    'show_in_nav_menus'             => true,
    'args'                          => array( 'orderby' => 'term_order' ),
    'rewrite'                       => array( 'slug' => 'property', 'with_front' => true, 'hierarchical' => true ),
    'query_var'                     => true
);

register_taxonomy( 'property_categories', 'property', $args );
}


add_action( 'init', 'property_post_type', 0 );
 add_role('seller', 'Seller', array(
    'publish_propety' => true,
 'edit_property' => true,
 'edit_others_property' => false,
 'delete_property' => true,
 'delete_others_property' => false,
 'read_private_property' => true,
 'edit_property' => true,
 'delete_property' => true,
 'read_property' => true,

 // more standard capabilities here
'read' => true,

));
if ( current_user_can('seller') && !current_user_can('upload_files') )
    add_action('admin_init', 'allow_seller_uploads');
在用户管理面板显示所有帖子…我想用户可以发布,删除,编辑只有自己的帖子而已

正在连接屏幕截图用户管理面板仪表板


你能试着更详细地解释一下你的帖子类型到底有什么问题吗?您的管理员用户应该能够执行上面提到的所有操作、发布、删除和编辑。如果您将项目悬停在后端,您应该会看到“编辑”和“删除”作为选项,这就是您要查找的内容吗?只希望用户只能发布、编辑、删除自己的帖子。从他的管理仪表板中隐藏其他用户帖子。。