如何从“ Adrerance”菜单中删除唯一的主题选项

发布于 2025-02-12 15:02:10 字数 444 浏览 2 评论 0原文

我想从WordPress仪表板中的“外观”菜单中删除主题选项。我要删除的选项标记为红色。

我已经尝试过,

remove_menu_page( 'themes.php' );

但是它完全删除了外观菜单。

我找到了另一个可以删除子菜单的功能,但不确定第二个选项必须是什么,因为外观和主题都链接到wp-admin/themes.php

remove_submenu_page( 'themes.php', '')

I want to only remove the Themes option from the Appearance menu in the WordPress dashboard. The option I want removed is marked in red.

enter image description here

I have tried,

remove_menu_page( 'themes.php' );

But it removed the Appearance menu completely.

I found another function to remove the sub menu but unsure what the second option has to be since both Appearance and Themes are linked to wp-admin/themes.php

remove_submenu_page( 'themes.php', '')

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美男兮 2025-02-19 15:02:10

这将做到。添加到功能文件:

function remove_menus(){  
remove_submenu_page( 'themes.php', 'themes.php');
}  
add_action( 'admin_menu', 'remove_menus' ); 

This will do it. Add to functions file:

function remove_menus(){  
remove_submenu_page( 'themes.php', 'themes.php');
}  
add_action( 'admin_menu', 'remove_menus' ); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文