Skip to content

Instantly share code, notes, and snippets.

@kodie
Created March 12, 2020 15:32
Show Gist options
  • Save kodie/14b3750c23662fdf87b4a7700f799d42 to your computer and use it in GitHub Desktop.
Save kodie/14b3750c23662fdf87b4a7700f799d42 to your computer and use it in GitHub Desktop.
Adds additional separators to WordPress's admin dashboard menu
<?php
// Adds additional separators to WordPress's admin dashboard menu
add_action('admin_menu', 'add_admin_menu_separators');
function add_admin_menu_separators() {
function add_separator($position) {
global $menu;
$index = 0;
foreach($menu as $offset => $section) {
if (substr($section[2], 0, 9) == 'separator') $index++;
if ($offset >= $position) {
$menu[$position] = array('', 'read', "separator$index", '', 'wp-menu-separator');
break;
}
}
ksort($menu);
}
// Change this index to wherever you'd like to place the separator
// Repeat the function to add multiple separators
add_separator(25);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment