Handy function to rewrite defined submenus
Created
September 7, 2016 10:26
-
-
Save jackabox/b88d11a5b270fde99f5a7be4c5ef152f to your computer and use it in GitHub Desktop.
WP submenu order rewrite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('custom_menu_order', 'submenu_order'); | |
| public function submenu_order($menu_ord) | |
| { | |
| global $submenu; | |
| // Enable the next line to see all menu orders | |
| // echo '<pre>'.print_r($submenu,true).'</pre>'; | |
| $arr = array(); | |
| $arr[] = $submenu['menu-name'][2]; // | |
| $arr[] = $submenu['menu-name'][0]; // | |
| $arr[] = $submenu['menu-name'][1]; // | |
| $submenu['menu-name'] = $arr; | |
| return $menu_ord; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment