WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I thought this would be a simple task, but I cannot find anything on google.

I would simply like to echo the meun_order value in my loop.

I tried this but it's not in the post_meta table, its in the post's table.

<?php echo get_post_meta($post->ID, 'menu_order', true); ?>

Can anyone help please?

Thanks Josh

share|improve this question
up vote 2 down vote accepted

You can't use get_post_meta since the menu_order is stored in the posts table, like you said. But you can set up an easy database query to get the value.

$menu_o = $wpdb->get_var( "SELECT menu_order FROM $wpdb->posts WHERE ID=" . $post->ID  );
echo $menu_o;
share|improve this answer
perfect dude, thanks so much for sharing. – Joshc Jan 23 '13 at 14:21

I have answered similar question here:

Get current menu_order

get_post_field( 'menu_order', $post_id);

or try this inside the loop

get_post_field( 'menu_order', $post->ID);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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