When interacting with the admin menu, for instance via add_menu_page
, there is a $position
parameter. The inline docs indicate that this should be an integer. The Codex agrees, but adds a note that you can use a float if you make it a string (e.g. '63.3'
). In wp-admin/includes/menu.php the array is sorted by comparing the keys with strnatcasecmp
.
With this in mind, one could set a menu position of '63-foo'
or '63-bar'
to avoid position conflicts. This would be especially helpful for plugins, where they currently may set a position which can cause conflicts in some themes or with other plugins.
Using strings appears to work just fine. I combed the source and didn’t find any issues, but maybe I’ve missed something. Are there any reasons why a string can’t or shouldn’t be used for the menu position?