diff --git src/wp-admin/includes/menu.php src/wp-admin/includes/menu.php
index 26ce6f3..7480402 100644
|
|
|
178 | 178 | } |
179 | 179 | unset($id, $data, $subs, $first_sub); |
180 | 180 | |
181 | | // Remove any duplicated separators |
182 | | $separator_found = false; |
183 | | foreach ( $menu as $id => $data ) { |
184 | | if ( false !== strpos( $data[4], 'wp-menu-separator' ) ) { |
185 | | if ( ! $separator_found ) { |
186 | | $separator_found = true; |
187 | | } else { |
188 | | unset($menu[$id]); |
189 | | } |
190 | | } else { |
191 | | $separator_found = false; |
192 | | } |
193 | | } |
194 | | unset($id, $data); |
195 | | |
196 | 181 | /** |
197 | 182 | * |
198 | 183 | * @param string $add |
… |
… |
|
318 | 303 | unset($menu_order, $default_menu_order); |
319 | 304 | } |
320 | 305 | |
| 306 | // Prevent adjacent separators |
| 307 | $prev_menu_was_separator = false; |
| 308 | foreach ( $menu as $id => $data ) { |
| 309 | if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { |
| 310 | |
| 311 | // This item is not a separator, so falsey the toggler and do nothing |
| 312 | $prev_menu_was_separator = false; |
| 313 | } else { |
| 314 | |
| 315 | // The previous item was a separator, so unset this one |
| 316 | if ( true === $prev_menu_was_separator ) { |
| 317 | unset( $menu[ $id ] ); |
| 318 | } |
| 319 | |
| 320 | // This item is a separator, so truthy the toggler and move on |
| 321 | $prev_menu_was_separator = true; |
| 322 | } |
| 323 | } |
| 324 | unset( $id, $data, $prev_menu_was_separator ); |
| 325 | |
321 | 326 | // Remove the last menu item if it is a separator. |
322 | 327 | $last_menu_key = array_keys( $menu ); |
323 | 328 | $last_menu_key = array_pop( $last_menu_key ); |