0

I hate it, when plugins add their own settings like this: WordPress admin 1

It's cluttered and annoying. Can I somehow move them in under 'Settings':

WordPress admin 2

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:

Yoast sub menu

  • Different plugins behave differently, so the answers could be endless. I would recommend a plugin like Admin Menu Editor to handle everything. – SeventhSteel Jun 19 '18 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 Jun 19 '18 at 20:38
0

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

| improve this answer | |
0

You 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.org/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' );
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.