Title: get_posts order doesn&#8217;t work
Last modified: August 19, 2016

---

# get_posts order doesn’t work

 *  [dooshan](https://wordpress.org/support/users/dooshan/)
 * (@dooshan)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/get_posts-order-doesnt-work/)
 * Help please!
 * I have listing of five latest post on my website. The code is:
 *     ```
       <ul>
       <?php $myposts = get_posts('numberposts=5&offset=0&order=ASC');
       foreach($myposts as $post) :?>
       <li><a href="<?php the_permalink(); ?>"><?php the_title();?></a></li>
       <?php endforeach; ?>
       </ul>
       ```
   
 * It used to work flawlessly but since my hosting company has moved to another 
   server everything is screwed up. It lists **first** five posts instead of last.
   When I change order to “order=DESC” it’s still the same. And it’s not the cache
   problem. On my local installation of the site everything works like it should.
 * Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 3 months ago](https://wordpress.org/support/topic/get_posts-order-doesnt-work/#post-691727)
 * See here:
 * [http://wordpress.org/support/topic/154622](http://wordpress.org/support/topic/154622)
 *  Thread Starter [dooshan](https://wordpress.org/support/users/dooshan/)
 * (@dooshan)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/get_posts-order-doesnt-work/#post-691958)
 * Tnx, I guess I should start wearing glasses because it’s a sticky topic 🙂
 *  Thread Starter [dooshan](https://wordpress.org/support/users/dooshan/)
 * (@dooshan)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/get_posts-order-doesnt-work/#post-692084)
 * Damn, I have the exact problem since I updated to 2.5. But this time the above
   link doesn’t help. Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get_posts order doesn’t work’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [dooshan](https://wordpress.org/support/users/dooshan/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/get_posts-order-doesnt-work/#post-692084)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
