menu_order
doesn’t mean the order in which it is used in any given custom menu. It means order by the “Order” attribute as entered in this box:
Counterintuitively this attribute is saved into the menu_order
column in the wp_posts
table in the database, which is why the orderby
argument value is menu_order
.
I’m not certain as I wasn’t using WordPress at the time, but I believe this is a holdover from a time when WordPress did not have customisable menus and the only way to output a menu of pages was the wp_list_pages()
function, which was introduced in 1.5.0
(wp_nav_menu()
wasn’t introduced until 3.0.0
). When that was the way of doing menus ordering menu items was done with this attribute.