[resolved] get_children => sort_order not working (3 posts)

  1. chriseverson
    Posted 5 years ago #

    I'm having trouble convincing a get_children query to order.

    I'm using the code below to pull children of the current page two at a time.

    for ($i = 0; $i < 10; $i++,$i++) { // iterate through by two
    		$args = array ('post_parent'=>get_the_ID(),'post_status'=>'publish','numberposts'=>2,'offset'=>$i,'sort_order'=>'ASC'); // Build the query
    		$prods = get_children($args);
    		if(empty($prods)) continue; // Exit loop

    Everything is working perfectly with the one exception of sort_order. I've tried putting it in every position in the array and still nothing changes when I do ASC or DESC as the value.

    Any ideas? I feel like I'm just missing something obvious and need an extra set of eyes.

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    i could not find 'sort_order' as a parameter of get_posts() or query_posts()


    'order' => 'DESC'

  3. chriseverson
    Posted 5 years ago #

    Wow. Thanks! I knew it was something stupid that I just overlooked.

Topic Closed

This topic has been closed to new replies.

About this Topic