我创建了自定义帖子类型(“组织”),我还创建了一个自定义用户角色(“代表”)。此外,我还确保代表角色具有读取/编辑/创建/发布帖子的功能。
然后,我以编程方式指定了一名代表作为;“作者”;组织的。
当我在组织概览屏幕(WP Admin>;Organizations)上时,我会在;“作者”;柱
但是,在编辑组织时;“作者”;下拉列表仅显示管理员/编辑器/贡献者。它不允许我查看/选择代表作为组织的作者。
我搜索过了,找不到答案。我做错了吗,或者有没有办法加入WP并让它识别其他角色?
编辑:以下是自定义帖子类型:
function cptui_register_my_cpts_organization_info() {
/**
* Post Type: Organizations.
*/
$labels = [
"name" => __( "Organizations", "hello-elementor-child" ),
"singular_name" => __( "Organization", "hello-elementor-child" ),
"menu_name" => __( "Organizations", "hello-elementor-child" ),
"all_items" => __( "All Organizations", "hello-elementor-child" ),
"add_new" => __( "Add New", "hello-elementor-child" ),
"add_new_item" => __( "Add new Organization", "hello-elementor-child" ),
"edit_item" => __( "Edit Organization", "hello-elementor-child" ),
"new_item" => __( "New Organization", "hello-elementor-child" ),
"view_item" => __( "View Organization", "hello-elementor-child" ),
"view_items" => __( "View Organizations", "hello-elementor-child" ),
"search_items" => __( "Search Organizations", "hello-elementor-child" ),
"not_found" => __( "No Organizations found", "hello-elementor-child" ),
"not_found_in_trash" => __( "No Organizations found in trash", "hello-elementor-child" ),
"parent" => __( "Parent Organization:", "hello-elementor-child" ),
"featured_image" => __( "Organization Logo", "hello-elementor-child" ),
"set_featured_image" => __( "Upload Organization Logo", "hello-elementor-child" ),
"remove_featured_image" => __( "Remove Organization Logo", "hello-elementor-child" ),
"use_featured_image" => __( "Use as logo for this Organization", "hello-elementor-child" ),
"archives" => __( "Organization archives", "hello-elementor-child" ),
"insert_into_item" => __( "Insert into Organization", "hello-elementor-child" ),
"uploaded_to_this_item" => __( "Upload to this Organization", "hello-elementor-child" ),
"filter_items_list" => __( "Filter Organizations list", "hello-elementor-child" ),
"items_list_navigation" => __( "Organizations list navigation", "hello-elementor-child" ),
"items_list" => __( "Organizations list", "hello-elementor-child" ),
"attributes" => __( "Organizations attributes", "hello-elementor-child" ),
"name_admin_bar" => __( "Organization", "hello-elementor-child" ),
"item_published" => __( "Organization published", "hello-elementor-child" ),
"item_published_privately" => __( "Organization published privately.", "hello-elementor-child" ),
"item_reverted_to_draft" => __( "Organization reverted to draft.", "hello-elementor-child" ),
"item_scheduled" => __( "Organization scheduled", "hello-elementor-child" ),
"item_updated" => __( "Organization updated.", "hello-elementor-child" ),
"parent_item_colon" => __( "Parent Organization:", "hello-elementor-child" ),
];
$args = [
"label" => __( "Organizations", "hello-elementor-child" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"delete_with_user" => false,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => [ "slug" => "org", "with_front" => true ],
"query_var" => true,
"menu_icon" => "dashicons-networking",
"supports" => [ "title", "editor", "thumbnail", "custom-fields", "author" ],
"taxonomies" => [ "organization_services" ],
"show_in_graphql" => false,
];
register_post_type( "organization_info", $args );
}
add_action( \'init\', \'cptui_register_my_cpts_organization_info\' );
编辑此外,我确保;“代表性”;用户级别至少为1:
然而,在做出这些更改之后,我仍然没有看到代表在;“作者”;此自定义帖子类型的下拉列表。
我甚至手动添加wp_user_level
并将其设置为2
的内部wp_usermeta
在DB中,但仍然不起作用。