Move plugin-settings to ‘Settings’-menu in the admin

WordPress admin 2

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:

Yoast sub menu

Read more here:: Move plugin-settings to ‘Settings’-menu in the admin

Leave a Reply

Your email address will not be published. Required fields are marked *