I am using Woo-Commerce and after activating it a new tab appears with name product I want to change the link of that product tab like if anyone click on that button it will be redirected to the front side add product link instead of Woo-commerce add product page can some one please help me.
1 Answer
You can modify the admin navigation using the $menu
global var. The following will accomplish what you're after
add_action( 'admin_menu', 'my_plugin_edit_admin_menu');
function my_plugin_edit_admin_menu() {
global $menu, $submenu;
foreach ($menu as $menuKey => $menuItem)
if ($menuItem[0] == 'Products')
$menu[$menuKey][2] = 'https://google.com/'; // wtv link you want
// UPDATE:
// remove the sub menu as well (note the GLOBAL var define above)
$submenu['edit.php?post_type=product'] = '';
unset($submenu['edit.php?post_type=product']);
}
-
Thank you so much @David it saved a day can you please tell that how can I hide the submenu as well of this product menu– MohsinDec 9, 2017 at 6:03
-
You may use
$submenu
to edit the submenu. I've updated the code with it above. Dec 9, 2017 at 19:35 -
Thank you so much it worked and saved most of my time Thank you once again.– MohsinDec 11, 2017 at 6:15