我看不到它。使用“Capability Manager”或“Members”等插件查看可用功能列表时,这些功能将无法显示。
这是我尝试使用的代码:
add_action( \'init\', \'register_taxonomy_spot_tag\' );
function register_taxonomy_spot_tag() {
$labels = array(
\'name\' => _x( \'Spot Tags\', \'spot tag\' ),
\'singular_name\' => _x( \'Spot Tag\', \'spot tag\' ),
\'search_items\' => _x( \'Search Spot Tags\', \'spot tag\' ),
\'popular_items\' => _x( \'Popular Spot Tags\', \'spot tag\' ),
\'all_items\' => _x( \'All Spot Tags\', \'spot tag\' ),
\'parent_item\' => _x( \'Parent Spot Tag\', \'spot tag\' ),
\'parent_item_colon\' => _x( \'Parent Spot Tag:\', \'spot tag\' ),
\'edit_item\' => _x( \'Edit Spot Tag\', \'spot tag\' ),
\'update_item\' => _x( \'Update Spot Tag\', \'spot tag\' ),
\'add_new_item\' => _x( \'Add New Spot Tag\', \'spot tag\' ),
\'new_item_name\' => _x( \'New Spot Tag Name\', \'spot tag\' ),
\'separate_items_with_commas\' => _x( \'Separate spot tags with commas\', \'spot tag\' ),
\'add_or_remove_items\' => _x( \'Add or remove spot tags\', \'spot tag\' ),
\'choose_from_most_used\' => _x( \'Choose from the most used spot tags\', \'spot tag\' ),
\'menu_name\' => _x( \'Spot Tags\', \'spot tag\' ),
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'show_in_nav_menus\' => true,
\'show_ui\' => true,
\'show_tagcloud\' => true,
\'hierarchical\' => false,
\'rewrite\' => true,
\'query_var\' => true,
\'capabilities\' => array(
\'manage_terms\' => \'manage_spot_tags\',
\'edit_terms\' => \'edit_spot_tags\',
\'delete_terms\' => \'delete_spot_tags\',
\'assign_terms\' => \'assign_spot_tags\'
)
);
register_taxonomy( \'spot_tag\', array(\'spot\'), $args );
}
我使用此工具生成了上述代码:
http://themergency.com/generators/wordpress-custom-taxonomy/
SO网友:Chris
这真的很老了,但在我的谷歌搜索中,我发现了一个很好的答案。
您不需要预先添加这些功能,只需在上面的代码中添加“,”map\\u meta\\u cap“=>true”,如下所示
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'show_in_nav_menus\' => true,
\'show_ui\' => true,
\'show_tagcloud\' => true,
\'hierarchical\' => false,
\'rewrite\' => true,
\'query_var\' => true,
\'capabilities\' => array(
\'manage_terms\' => \'manage_spot_tags\',
\'edit_terms\' => \'edit_spot_tags\',
\'delete_terms\' => \'delete_spot_tags\',
\'assign_terms\' => \'assign_spot_tags\'
),
\'map_meta_cap\' => true
);
这将使其无缝地添加功能