orderby menu_order not working in WP 6.2.2
-
Neither of these is working in wordpres 6.2.2
function set_posts_per_page_for_cpt( $query ) { if ( !is_admin() && $query->is_main_query()) { $query->set('orderby', 'menu_order'); $query->set('order', 'ASC'); } if ( !is_admin() && $query->is_main_query() && is_post_type_archive( 'mobile_vehicles' ) ) { $query->set( 'posts_per_page', '-1' ); } } add_action( 'pre_get_posts', 'set_posts_per_page_for_cpt' );
or this:
$allves = get_posts(array( 'post_type' => 'mobile_vehicles', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC' ));
- The topic ‘orderby menu_order not working in WP 6.2.2’ is closed to new replies.