Query menu_order custom post types

I’ve just had to do the same thing as you, here is what I did to get this working:

'supports' => array('title', 'editor', 'thumbnail', 'page-attributes')

Register the post type with supports of page attributes. This adds the menu order meta box to the edit screen. From there you can place the order.

Then run my custom query:

$args = array(
    'numberposts' => -1,
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'post_type' => 'staff'
);
$staff = get_posts($args);

set orderby to menu_order and order to ASC. Remember if you do not set a value in menu order it sets it to 0. So any posts without an order set will appear first.

Leave a Comment