admin管理员组文章数量:1297002
I hate it, when plugins add their own settings like this:
It's cluttered and annoying. Can I somehow move them in under 'Settings':
I imagined something like, checking if there is a plugin by the given name; and if there is, then remove it from the admin bar, like this (however, this doesn't work):
function custom_menu_page_removing() {
// Neither of these two work (the first is the
// link, the second is the slug
remove_menu_page( 'admin.php?page=themepacific_jp_gallery' );
remove_menu_page( 'tiled-gallery-carousel-without-jetpack' );
}
add_action( 'admin_menu', 'custom_menu_page_removing' );
I then imagined adding a link to generel settings like this:
function example_admin_menu() {
global $submenu;
$url = home_url() . '/wp-admin/admin.php?page=wpseo_dashboard';
$submenu['options-general.php'][] = array('Yoast', 'manage_options', $url);
}
add_action('admin_menu', 'example_admin_menu');
But my two problems are these:
- I can't find the correct
remove_menu_page( 'URL' );
to remove either Yoast or TP Tiled Gallery. How do I do that? - If I remove the Yoast, - what will then happen to the sub-menu? How do I access that:
I hate it, when plugins add their own settings like this:
It's cluttered and annoying. Can I somehow move them in under 'Settings':
I imagined something like, checking if there is a plugin by the given name; and if there is, then remove it from the admin bar, like this (however, this doesn't work):
function custom_menu_page_removing() {
// Neither of these two work (the first is the
// link, the second is the slug
remove_menu_page( 'admin.php?page=themepacific_jp_gallery' );
remove_menu_page( 'tiled-gallery-carousel-without-jetpack' );
}
add_action( 'admin_menu', 'custom_menu_page_removing' );
I then imagined adding a link to generel settings like this:
function example_admin_menu() {
global $submenu;
$url = home_url() . '/wp-admin/admin.php?page=wpseo_dashboard';
$submenu['options-general.php'][] = array('Yoast', 'manage_options', $url);
}
add_action('admin_menu', 'example_admin_menu');
But my two problems are these:
- I can't find the correct
remove_menu_page( 'URL' );
to remove either Yoast or TP Tiled Gallery. How do I do that? - If I remove the Yoast, - what will then happen to the sub-menu? How do I access that:
- Different plugins behave differently, so the answers could be endless. I would recommend a plugin like Admin Menu Editor to handle everything. – SeventhSteel Commented Jun 19, 2018 at 17:22
- Is it at least just possible to simple hide them then (and not care about the settings for the given plugin)? I'm trying to keep the plugins to a minimum... – Zeth Commented Jun 19, 2018 at 20:38
2 Answers
Reset to default 3You seem to be making life complicated. Here's the code you need;
function menu_shuffle() {
remove_menu_page( 'plugin-page' );
add_submenu_page('options-general.php','Page Title', 'Menu Label','manage_options', 'plugin-page' );
};
add_action( 'admin_menu', 'menu_shuffle' );
plugin-page
can be found by mousing over the existing menu label and getting the part after the ?page=
in this case ?page=plugin-page
The Wordpress function definition for add_submenu_page()
https://developer.wordpress/reference/functions/add_submenu_page/ includes a list of all the menu page slugs (and you need the '.php').
so in the example above for Yoast (bless its pointy little head and use Hide SEO Bloat)
function menu_shuffle() {
remove_menu_page( 'wpseo_dashboard' );
add_submenu_page('options-general.php','Yoast SE0', 'SEO','manage_options', 'wpseo_dashboard' );
};
add_action( 'admin_menu', 'menu_shuffle' );
For Yoast, you can easily hide it, the settings are also in the WP topbar. :)
To hide it, use this code :
function mte_custom_menu_page_removing() {
remove_menu_page( 'wpseo_dashboard' ); //Yoast
I am also interested to know how to move all other plugins in the settings submenu.
-> Maybe an other solution here
本文标签: Move pluginsettings to 39Settings39menu in the admin
版权声明:本文标题:Move plugin-settings to 'Settings'-menu in the admin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741647239a2390257.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论