Is it possible to sort by 'menu_order' in the admin display screen on non-hierarchical custom post types?
I'm trying to do something like this, but it only works for hierarchical post types.
function set_custom_post_types_admin_order($wp_query) {
if (is_admin()) {
// Get the post type from the query
$post_type = $wp_query->query['post_type'];
// if it's one of our custom ones
if ( $post_type == 'my_custom_post_type') {
$wp_query->set('orderby', 'menu_order');
$wp_query->set('order', 'ASC');
}
}
}
add_filter('pre_get_posts', 'set_custom_post_types_admin_order');