In this tutorial we’ll learn how to remove admin menu pages inserted by plugins. Sometimes when we uninstall a pluginit didn’t completely remove its traces and leave the admin menu links/pages behind.
There is a programmatic way of removing these kind of pages.
For example, here is my wordpress admin menu:
Now let’s say i want to remove the tools link from the admin menu.
If you click on the link you’ll find out the url behind that link. In my case i.e.
http://localhost/wordpress/wp-admin/tools.php
or even if you hover over the link you’ll see the directing url at the bottom of the page.
So, from this we can find out that this link is directing to the file tools.php. So, we’ll use this in the function to remove this menu page.
add_action('admin_init', 'wpse_remove_menu_pages'); functionwpse_remove_menu_pages() { remove_menu_page('tools.php'); }
Copy the complete url of the page you want to remove and paste in the function parameter.
Place the above code in functions.php of your theme.
Refresh the admin page and the provided menu link will be removed from the admin menu.