• Skip to primary navigation
  • Skip to content
  • Skip to footer

Drew Poland

Freelance WordPress Developer

  • About
  • Portfolio
  • Services
    • WordPress Design
    • WordPress Development
    • Project Consulting
  • Blog
  • Lets Talk

Reverse Menu Sort Order on wp_nav_menu

You are here: Home / WordPress Development / Reverse Menu Sort Order on wp_nav_menu


Just ran into something where I was using CSS to float wp_nav_menu to the right, so it was displaying in reverse order than what was set in Appearance > Menus.

Solution? Add a function to your functions.php to reverse the sort order wp_nav_menu.
[php]add_filter( ‘wp_nav_menu_objects’, create_function( ‘$menu’, ‘return array_reverse( $menu );’ ) );[/php]

About Drew Poland

Drew Poland is a WordPress Developer from Baltimore Maryland, often seen wearing Argyle, combing his beard and drinking absurd amounts of coffee.

Reader Interactions

Comments

  1. ExlAdm says

    November 6, 2012 at 1:18 AM

    Thanks man :)
    Was looking for that and just made my day :)
    Thanks again, i’ll be looking at your blog later :)

    Reply
  2. Kenth Hagström says

    May 22, 2013 at 1:19 PM

    Really cool, but is there a way to do this on a specific menu also?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

learn more

  • About
  • Speaking
  • Blog

work with me

  • Contact
  • Submit RFP
  • Project Worksheet