ポートフォリオメニューから「タグ」サブメニューを削除しようとしています。これは私が使用しているものです:
add_action( 'admin_menu', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
if(!current_user_can('create_users')) {
remove_submenu_page( 'edit.php', 'tags.php' );
remove_submenu_page( 'edit.php?post_type=portfolio', 'edit-tags.php?taxonomy=post_tag&post_type=portfolio' );
}
}
しかし、それは単に行きません。var_dump($submenu); の出力は次のとおりです。関数:
Stackoverflow は投稿にもっと多くのテキストを必要とします ¬¬ そのため、テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト
array(12) {
["index.php"]=>
array(1) {
[0]=>
array(3) {
[0]=>
string(7) "Início"
[1]=>
string(4) "read"
[2]=>
string(9) "index.php"
}
}
["edit.php"]=>
array(4) {
[5]=>
array(3) {
[0]=>
string(14) "Todos os Posts"
[1]=>
string(10) "edit_posts"
[2]=>
string(8) "edit.php"
}
[10]=>
array(3) {
[0]=>
string(14) "Adicionar Novo"
[1]=>
string(10) "edit_posts"
[2]=>
string(12) "post-new.php"
}
[15]=>
array(3) {
[0]=>
string(10) "Categorias"
[1]=>
string(17) "manage_categories"
[2]=>
string(31) "edit-tags.php?taxonomy=category"
}
[16]=>
array(3) {
[0]=>
string(4) "Tags"
[1]=>
string(17) "manage_categories"
[2]=>
string(31) "edit-tags.php?taxonomy=post_tag"
}
}
["upload.php"]=>
array(1) {
[5]=>
array(3) {
[0]=>
string(10) "Biblioteca"
[1]=>
string(12) "upload_files"
[2]=>
string(10) "upload.php"
}
}
["link-manager.php"]=>
array(3) {
[5]=>
array(3) {
[0]=>
string(14) "Todos os Links"
[1]=>
string(12) "manage_links"
[2]=>
string(16) "link-manager.php"
}
[10]=>
array(3) {
[0]=>
string(14) "Adicionar novo"
[1]=>
string(12) "manage_links"
[2]=>
string(12) "link-add.php"
}
[15]=>
array(3) {
[0]=>
string(19) "Categorias de Links"
[1]=>
string(17) "manage_categories"
[2]=>
string(36) "edit-tags.php?taxonomy=link_category"
}
}
["edit.php?post_type=page"]=>
array(2) {
[5]=>
array(3) {
[0]=>
string(17) "Todas as Páginas"
[1]=>
string(10) "edit_pages"
[2]=>
string(23) "edit.php?post_type=page"
}
[10]=>
array(3) {
[0]=>
string(14) "Adicionar Nova"
[1]=>
string(10) "edit_pages"
[2]=>
string(27) "post-new.php?post_type=page"
}
}
["edit-comments.php"]=>
array(1) {
[0]=>
array(3) {
[0]=>
string(21) "Todos os Comentários"
[1]=>
string(10) "edit_posts"
[2]=>
string(17) "edit-comments.php"
}
}
["edit.php?post_type=portfolio"]=>
array(4) {
[5]=>
array(3) {
[0]=>
string(9) "Portfolio"
[1]=>
string(10) "edit_posts"
[2]=>
string(28) "edit.php?post_type=portfolio"
}
[10]=>
array(3) {
[0]=>
string(14) "Adicionar Novo"
[1]=>
string(10) "edit_posts"
[2]=>
string(32) "post-new.php?post_type=portfolio"
}
[15]=>
array(3) {
[0]=>
string(4) "Tags"
[1]=>
string(17) "manage_categories"
[2]=>
string(55) "edit-tags.php?taxonomy=post_tag&post_type=portfolio"
}
[16]=>
array(3) {
[0]=>
string(23) "Categorias de Portfolio"
[1]=>
string(17) "manage_categories"
[2]=>
string(65) "edit-tags.php?taxonomy=portfolio_category&post_type=portfolio"
}
}
["edit.php?post_type=slideshow"]=>
array(2) {
[5]=>
array(3) {
[0]=>
string(7) "Banners"
[1]=>
string(10) "edit_posts"
[2]=>
string(28) "edit.php?post_type=slideshow"
}
[10]=>
array(3) {
[0]=>
string(14) "Adicionar Novo"
[1]=>
string(10) "edit_posts"
[2]=>
string(32) "post-new.php?post_type=slideshow"
}
}
["themes.php"]=>
array(1) {
[10]=>
array(3) {
[0]=>
string(5) "Menus"
[1]=>
string(18) "edit_theme_options"
[2]=>
string(13) "nav-menus.php"
}
}
["profile.php"]=>
array(1) {
[5]=>
array(3) {
[0]=>
string(10) "Seu perfil"
[1]=>
string(4) "read"
[2]=>
string(11) "profile.php"
}
}
["tools.php"]=>
array(1) {
[5]=>
array(3) {
[0]=>
string(12) "Disponíveis"
[1]=>
string(10) "edit_posts"
[2]=>
string(9) "tools.php"
}
}
["options-general.php"]=>
array(1) {
[0]=>
array(4) {
[0]=>
string(16) "Support settings"
[1]=>
int(1)
[2]=>
string(16) "support_settings"
[3]=>
string(16) "Support settings"
}
}
}