Skip to content

Instantly share code, notes, and snippets.

@kopepasah
Created November 16, 2016 07:06
Show Gist options
  • Save kopepasah/5af2ec44333f57350050838d5d61fbd1 to your computer and use it in GitHub Desktop.
Save kopepasah/5af2ec44333f57350050838d5d61fbd1 to your computer and use it in GitHub Desktop.
Simple filter for adding a menu separator at a specific location on the WordPress admin menu.
<?php
/**
* Adds a separator to the administration menus in a specific location.
*
* @param array $menu Associative array of administration menu items.
*
* @return array $menu Modified associative array of administration menu items.
*/
add_filter( 'add_menu_classes', function( $menu ) {
$menu['44'] = array(
null,
'edit_posts',
'separator-custom',
null,
'wp-menu-separator',
);
ksort( $menu );
return $menu;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment