Remove tools.php page from WordPress admin

Background

The WordPress admin section (/ wp-admin) contains a menu item called tools (between users and settings). It has an intrusive sub-item called "Available Tools", which is a page containing the "Click This" feature.

/wp-admin/tools.php

My question

How to remove this page from the tools section?

What i tried

I tried a function to delete a menu item:

    add_action( 'admin_menu', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
    remove_menu_page('press-this.php');
    //remove_menu_page('tools.php');
}

If I delete tools.php, the entire tool section is deleted, not just the Available Tools section.

I also tried removing the press-this.php file from the directory.

None of the approaches helped.

I can not find a solution anywhere online. Any help would be greatly appreciated.

+3
3

WP:

add_action( 'admin_menu', 'remove_tools' );
function remove_tools() {
    remove_submenu_page('tools.php', 'tools.php');
}
+6

admin_menu hook $submenu var:

add_action('admin_menu','modify_menu');

function modify_menu()
{
  global $submenu;
  unset($submenu['tools.php'][5]);
}

EDIT: , remove_submenu_page

+3

Try this code. It hides all the Tools menu if there are no other tools available to the user.

add_action('admin_init', 'remove_tools_admin_menu');
    function remove_tools_admin_menu() {
        global $submenu;
        unset($submenu['tools.php'][5]);
        if(count($submenu['tools.php']) == 0) {
            remove_menu_page('tools.php');
        }
}
+2
source

All Articles