admin管理员组文章数量:1122832
I'm working on customizing the admin sidebar menu specifically for the WordPress Multisite Network Admin area. I want to add a new top-level menu called "Header Builder" and some submenus like "Top Bar Menu" and "Main Menu". When any of these submenus are clicked, the admin sidebar should remain the same as in the network admin interface.
Here are my requirements:
No plugins – I want to modify the core or theme files directly to achieve this. The new menu should appear in the Network Admin Sidebar. The menu should have nested submenus (e.g., "Top Bar Menu", "Main Menu"). The sidebar menu should persist when navigating between these submenus. I’ve found lots of resources about adding admin menus in standard WordPress but nothing specific to network admin customization without using plugins.
Any help on which files to modify or how to hook into the admin menu for multisite would be greatly appreciated!
I'm working on customizing the admin sidebar menu specifically for the WordPress Multisite Network Admin area. I want to add a new top-level menu called "Header Builder" and some submenus like "Top Bar Menu" and "Main Menu". When any of these submenus are clicked, the admin sidebar should remain the same as in the network admin interface.
Here are my requirements:
No plugins – I want to modify the core or theme files directly to achieve this. The new menu should appear in the Network Admin Sidebar. The menu should have nested submenus (e.g., "Top Bar Menu", "Main Menu"). The sidebar menu should persist when navigating between these submenus. I’ve found lots of resources about adding admin menus in standard WordPress but nothing specific to network admin customization without using plugins.
Any help on which files to modify or how to hook into the admin menu for multisite would be greatly appreciated!
Share Improve this question asked Sep 16, 2024 at 12:33 TheAMTheAM 1 2- 2 Obligatory don't do that. If you modify the core files then your changes would get wiped by an auto-update. You can work around this, e.g. by turning off auto-updates, or working with a git checkout and a branch, or creating a patch with your changes that you apply to the update after it's been downloaded, or something else, but it's going to be hassle. The point of all the hooks is so that you can do customisation from plugins: unless you need to do something there isn't a hook for then plugins are the way to go. – Rup Commented Sep 16, 2024 at 13:08
- 1 But honestly if you're editing the files, do you need our help? Just find the file with the menu you want to modify and edit it. If you've got advice how to do it with a plugin, look at what hook they're hooking then find where that's called from and that's where you need to look. – Rup Commented Sep 16, 2024 at 13:09
1 Answer
Reset to default 1Firstly, you should absolutely not modify core files. Ever. Any changes you make to core files can and will be overwritten any time WordPress updates. There are umpteen ways in which WP has been written to allow you to change its behaviour without hacking on core files: hooks, filters, APIs. Use those instead.
In this case you should be writing a plugin, because you're changing functionality. That's in a plugin's wheelhouse, a theme should only be concerned with displaying the frontend of the site.
You can add to the sidebar with add_menu_page()
and add_submenu_page()
, both of which are well documented in the developer docs I linked.
本文标签:
版权声明:本文标题:php - How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code f 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736291638a1928766.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论