I'll give up. Have searched and searched and tried and tried... Can't find any solution to list previous posts.

On a single post: I want to show a list of the 10 previous posts, the 10 before the current post. So, not just a two prev and next links. Not the most recent posts that is. A list of the the 10 previous posts before the current post you are visiting.

I'm trying to make a query and comparing post_date lower than get_the_date('Y-m-d H:i:s'). But it's not working. I guess post_date isn't an allowed key to use in 'compare'.

Any ideas?

Edit: The code right now:

$posts_args = array(
    'posts_per_page' => 10
  , 'meta_query'=> array(
            'key'     => 'post_date'
          , 'compare' => '<'
          , 'value'   => get_the_date('Y-m-d H:i:s')
$myposts = query_posts($posts_args);
  • Please post all of your relevant code.
    – s_ha_dum
    Commented Nov 15, 2015 at 23:32
  • I change it continuously cause I'm testing different things. But look at my edit now. Commented Nov 15, 2015 at 23:41
  • i think you are doing this for auto linking? did you achieve that? Commented Sep 1, 2022 at 3:36

1 Answer 1


Did you chceck the Codex Date Parameters ? Expecially the 'before' param.
It works like this:

$date = get_the_date('Y-m-d H:i:s');
$args = array(
    'date_query' => array(
            'before' => $date
    'posts_per_page' => 10,
$query = new WP_Query( $args );
  • Strange. Some how, this code makes the page doing an redirection to the "Hello world" (first) post. Commented Nov 16, 2015 at 0:13
  • Aha, I needed <?php wp_reset_postdata(); ?> Commented Nov 16, 2015 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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