Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active December 23, 2015 00:29
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 jaredatch/6553862 to your computer and use it in GitHub Desktop.
Save jaredatch/6553862 to your computer and use it in GitHub Desktop.
Reorder the menu, JetPack style
<?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