Background
The WordPress admin section (/wp-admin) contains a menu item named tools (between users and settings). It has an obtrusive sub-item named “Available Tools” which is a page that contains a feature named “Press This”.
/wp-admin/tools.php
My question
How do I remove this page from the tools section?
What I’ve tried
I’ve tried a function to remove 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 remove tools.php, the entire tools section is removed rather than just the “Available Tools” section.
I’ve also tried deleting the press-this.php from the directory.
Neither approaches have been to any avail.
I cannot find a solution anywhere online. Any help would be greatly appreciated.
this way uses WP functions:
tested and work
You can use
admin_menu
hook to modify$submenu
global var :EDIT : as janw said in his answer, you should instead use remove_submenu_page
Try this code. It hides the entire Tools menu if there’s no other tools available to the user.