Ready to get started?Download WordPress


Sort Query by Post In
Doesn't seem to work with WPML (1 post)

  1. sanch3x
    Posted 1 year ago #

    I'm running this plugin with WPML and nothing shows up in my loop when I'm running it.

    I added 'suppress_filters' => 1 to my args array and the pages appear but they are still out of order.

    Here's my code, maybe I'm doing something wrong?

    $args = array(
    				'order' => 'ASC',
    				'orderby' => 'menu_order',
    				'output' => ARRAY_A,
    				'output_key' => 'menu_order'
    	$items_objs = wp_get_nav_menu_items( 'main_nav', $args );
    	$items = array();
    	foreach( $items_objs as $obj ) {
    		$items[] = $obj->object_id;
    	$args = array(
    		'post_type' => 'page',
    		'post_count' => -1,
    		'post__in' => $items,
    		'orderby' => 'post__in',
    		'order' => 'ASC',
    		'suppress_filters' => 1
    	$pages = new WP_Query( $args );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.