Last active
December 23, 2015 00:29
-
-
Save jaredatch/6553862 to your computer and use it in GitHub Desktop.
Reorder the menu, JetPack style
This file contains 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
<?php | |
// Enable menu ordering | |
add_filter( 'custom_menu_order', '__return_true' ); | |
/** | |
* Change the menu order, the JetPack way. | |
* | |
* @since 1.0.0 | |
* @param array $menu_order | |
* @return array | |
*/ | |
function ja_menu_order( $menu_order ) { | |
$new_menu_order = array(); | |
foreach ( $menu_order as $index => $item ) { | |
if ( $item != 'edit.php?post_type=report' ) | |
$new_menu_order[] = $item; | |
if ( $index == 2 ) | |
$new_menu_order[] = 'edit.php?post_type=report'; | |
} | |
return $new_menu_order; | |
} | |
add_filter( 'menu_order', 'ja_menu_order' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment