Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
2 I have described the problem in further details.
source | link

// EDIT - more detailed explanation of the problem

My original post on the old website is from, let say, Jan 1 2001 (original date). Next, I create a post on the new website on Sep 22 2013 (today) and manually set the publish date in the Post Edit area to the original date. I can see in the $wpdb post_date=2001-01-01 and post_modified=2013-09-22. The last post shortcode return the post with the latest post-modified date instead of the latest post_date.

// EDIT - end

I'm running a custom WP_Query within a plugin's slide, using a short tag to place it there. The problem is, that it takes the last modified post instead of last published post.

I'm running a custom WP_Query within a plugin's slide, using a short tag to place it there. The problem is, that it takes the last modified post instead of last published post.

// EDIT - more detailed explanation of the problem

My original post on the old website is from, let say, Jan 1 2001 (original date). Next, I create a post on the new website on Sep 22 2013 (today) and manually set the publish date in the Post Edit area to the original date. I can see in the $wpdb post_date=2001-01-01 and post_modified=2013-09-22. The last post shortcode return the post with the latest post-modified date instead of the latest post_date.

// EDIT - end

I'm running a custom WP_Query within a plugin's slide, using a short tag to place it there. The problem is, that it takes the last modified post instead of last published post.

1
source | link

Last post ordered by publish date using WP_Query on front page

I'm joining together few websites into one and I created appropriate posts and changed their post_date (publish date) to the original time of post. However (even if I list more than 1 post) the result, I get, is the last post according to quite recent 'post_modified' (last update of the post).

I'm running a custom WP_Query within a plugin's slide, using a short tag to place it there. The problem is, that it takes the last modified post instead of last published post.

My code for the shorttag:

//[latestpost]
function latestpost_func( $atts ){
    global $post;
    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $query = new WP_Query( array( 'paged' => $paged ) );
    $latestpost_arg = array(
                          'post_type' => 'post',
                          'posts_per_page' => 1,
                          'orderby' => 'date',
                          'order' => 'DESC',
                          'paged' => $paged,
                          'ignore_sticky_posts' => 1,
                          'category__in' => array( 127, 253 )
            );
    $latestpost_query = null;
    wp_reset_query();
    $latestpost_query = new WP_Query($latestpost_arg);


     if ( $latestpost_query -> have_posts() ) :
      while ($latestpost_query -> have_posts()) :
            $latestpost_query -> the_post();
            if (has_post_thumbnail()) {
                $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
                $latestpost_image_div = '<div class="slide-post-image"><img src="' . $large_image_url[0] . '" /></div>';
            }

            $latestpost_details_div = '<div class="slide-post-details-div"><h2 class="latest-post-title">' . get_the_title() . '</h2><p class="latest-post-excerpt">' . get_the_excerpt() . '</p></div>';

            $latestpost_output = $latestpost_image_div . $latestpost_details_div;
      endwhile;
     else :
        $latestpost_output = 'Sorry, no posts matched your criteria.';
     endif;

  return $latestpost_output;
 }

 add_shortcode( 'latestpost', 'latestpost_func' );