0

I am trying to return a menu in alphabetical order and not the order set by the user in the backend. I have this code but it is not alphabetical:

$args = array(
    'order'                  => 'ASC',
    'orderby'                => 'title',);
$menu= wp_get_nav_menu_items($menu->term_id, $args);
1

Absolutely no idea why I got a negative vote on this. Turns out this is actually a bug in wordpress: https://core.trac.wordpress.org/ticket/15533

The solution is to use "object" instead of "array".

$args = array(
    'orderby'=> 'title',
    'output' => object);

Hope it helps someone else.

Not the answer you're looking for? Browse other questions tagged or ask your own question.