Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomaskavalek/3abd1fc037e2b512ba17b04ca3bbecc0 to your computer and use it in GitHub Desktop.
Save tomaskavalek/3abd1fc037e2b512ba17b04ca3bbecc0 to your computer and use it in GitHub Desktop.
Allow access WooCommerce orders old way, instead of opening dashboard
<?php
function tk_admin_menu_order()
{
global $submenu;
// WooCommerce
if ( ! isset($submenu['woocommerce'])) {
return false;
}
// Move WooCommerce Dashboard menu item
$index = null;
$woocommerce = $submenu['woocommerce'];
foreach ($woocommerce as $key => $item) {
if (isset($item[2]) && ($item[2] === 'wc-admin') && ($item[0] != '')) {
$index = $key;
}
}
if (is_null($index)) {
return false;
}
$submenu['woocommerce'][] = $submenu['woocommerce'][$index];
unset($submenu['woocommerce'][$index]);
return true;
}
add_filter('admin_head', 'tk_admin_menu_order', 9999);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment