Get newest post url

You can use this to the the url of the most recent post.
//list post title for one post is specified category
$cat = 1; //category ID
   'category__in' => array($cat),
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
wp_reset_query();  // Restore global post data stomped by the_post().

Leave a Reply