Every now and again we have a customer ask us if it’s possible to hide the “Migrate DB Pro” menu item from the WordPress dashboard. As a result we’ve decided to bake this functionality into our tweaks plugin.
If you haven’t read up on the tweaks plugin you can do so in this blog post.
Why hide the menu item?
It is rarely the case that a client would ever need access to WP Migrate DB Pro. And having that menu item could add confusion for your client. They might wonder what it is and even start poking around. They could mess with the security settings, reset your API key, or even replace the entire database if they run a push from another site. WP Migrate DB Pro is intended for developers and should only be used by those who understand what they’re doing.
You could just deactivate and uninstall the plugin on the live site. But as a developer, you usually still want to it active on the site so you can pull down the latest data when the need arises. Another solution here is to simply hide the menu item.
How does it work?
- Download and install the WP Migrate DB Pro tweaks plugin
- Uncomment line 46, i.e. change:
//add_filter( 'admin_menu', array( $this, 'remove_menu_item' ) );
add_filter( 'admin_menu', array( $this, 'remove_menu_item' ) );
- Save the file
How do I access the page now?
This method only hides the menu item, you can still access the plugin page directly by navigating to the following URL:
Of course, you could also use this as sample code and add it to your theme or one of your plugins. And even add an if statement to only remove the menu item when it’s not you that’s logged in.
As usual, we love to hear your feedback! Please let us know in the comment section below if you have any question about the above or really anything WP Migrate DB Pro related.