WordPress.org

Support

Support » How-To and Troubleshooting » Most Recent Post … Not Most Recent

Most Recent Post … Not Most Recent

  • I have a link I am generating for the most recent post in a category…

    <?php
    $args = ('cat=57&posts_per_page=1&orderby=date&order=ASC');
    /* I've also tried */
    /* $args = array(
         'cat' => 57,
         'posts_per_page' => 1,
         'order' => 'ASC'
       );
    */
    $my_query = new WP_Query($args);
    while ($my_query->have_posts()) {
          $my_query->the_post(); ?>
          <a href='<?php the_permalink(); ?> ' >UP TO SPEED</a>
    <?php } wp_reset_query(); ?>

    The problem is, it is not showing the MOST RECENT post.

    The post it is showing has a published date of 2012/03/02. The problem is, there are posts in that same category that are newer:

    2012/03/10
    2012/03/09
    2012/03/03
    >> 2012/03/02 – Shows as current
    2012/02/10

    I checked that it is pulling the correct category. All of the posts above are “published” and not hidden. I also checked if it was pulling articles by revision date … but it wasn’t.

    Basically, when I add a new article in that category and hit PUBLISH, the new article doesn’t appear in that link. NOTE: I have similar “links” like this for other categories and they pull the correct information.

    Please help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Most Recent Post … Not Most Recent’ is closed to new replies.
Skip to toolbar