WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At first I thought the task was trivial. I'd like to list the most recently added posts (say, 15 of them), but I am adding posts that are dated a few years back, yet I'd like them to show in the list, instead of just the ones that are dated the most recent.

This is what I'm doing so far:

    $args = array( 'orderby' => 'modified', 'numberposts' => 15 );
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post);

        $audio = get_children(
                'post_parent' => $post->ID,
                'post_status' => 'inherit',
                'post_type' => 'attachment',
                'post_mime_type' => 'audio'
        $thishref = "";
        foreach ( $audio as $attachment_id => $attachment ) : 
            $thishref.= wp_get_attachment_url( $attachment_id, 'full' );
    <a href="<?php the_permalink(); ?>"><?php the_title();?></a>&nbsp;
    <span title="comments" class="commentCount">(<?php comments_number( '0', '1', '%' ); ?>)</span>&nbsp;&nbsp;
    <a title="download" class="downloadlink" href="<?php echo $thishref; ?>">&darr;</a>

It works, except if I add tags to a post or edit it in any way, the post becomes 'modified' and thus appears in this list, and I'd like to prevent this from happening.

In other words, I want to list 15 most recent posts not by their date, not by their modified date, but by the date they were added to the database of posts ('created' date?).

Would this be at all possible?

share|improve this question
up vote 3 down vote accepted


$postslist = get_posts( 'orderby=ID&numberposts=15' );

Here, we're ordering by the ID, which should relate to when the posts were added to the database.

share|improve this answer
Thank you very much! Simple and elegant solution. – pereyra Feb 19 '13 at 15:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.