Support » Fixing WordPress » 'orderby'=>"post_date" not working

  • Resolved icakeov


    I have just realized that the get_posts function is not displaying the latests posts. It seems to display posts that is a day or two old and then goes back until it reaches the numberposts amount.

    The first batch is displaying featured 4 posts:

    $args = array( 'numberposts' => 4, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date",'order'=> 'DESC','tag'=>"Feature",'category__not_in'=> array(19,27,454));
        					$postslist = get_posts( $args );

    And then this is the part that is not displaying the newest posts (perhaps the above code messes things up?)

    $args = array('offset'=> 4, 'numberposts' => 10, 'post_status'=>"publish",'post_type'=>"post",'order'=> 'DESC','orderby'=>"post_date",'post__not_in'=> $not_duplicate, 'category__not_in'=> array(19,27,454));

    here’s the page:

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


    post_date is the name of a column but ‘orderby’=>”post_date” should be ‘orderby’=>”date”.



    Thanks WPShowCase, I replaced it with ‘date’ yet the issue is still there. There actually is a posting that was published yesterday that’s not displaying still.



    Figured it out! It was the offset being 4. I am already keeping track of the featured images through a parameter so it was unnecessary to offset the posts.
    Thanks again for your help WPShowCase

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘'orderby'=>"post_date" not working’ is closed to new replies.