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

WordPress implements a simple order functionality by default.

What's the common method, to retrieve the menu_order for the current post or page?

share|improve this question
up vote 7 down vote accepted

If you have the post with an $id:

$thispost = get_post($id);
$menu_order = $thispost->menu_order;

WordPress itself does not provide a function to get the menu_order, so you have to query the post-Object. If you are outside the loop, you can use the above function, however inside the loop you could also achieve this by:

global $post;
$menu_order = $post->menu_order;

The Menuorder is mainly used for Database Queries, as the Name says, do determine the Order of the output (if the menuorder is selected to be the order criteria).

share|improve this answer

You can try following code:

 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.