Wordpres pick up the modified post

Asked

Viewed 25 times

0

I need help with a query post:

How do to view the posts that were modified say updated example:

a post was registered if it was modified today I need to display and what was modified by a query post a sort of query_post review

would that be possible? follows an example query_post loop:

<?php
$args = array(
  
  'post_type' => 'post',
  'post_status' => 'inherit',    


  );
?>

<?php $the_query = new WP_Query( $args ); ?>
<?php if ($the_query->have_posts()): while ($the_query->have_posts()) : $the_query->the_post();?>

<!--POST QUE FORAM MODIFICADO ATUALIZADO -->

<?php the_title();?>
						
 <?php endwhile; else: ?>
 <?php endif; ?>

1 answer

1


You can pick up posts by modified date, e.g.:

$args = array( 
'post_type' => 'post',
'post_status' => 'inherit', 
'orderby'     => 'modified', 
'order'       => 'DESC',
'posts_per_page' => -1,

);

If you want to pick up the modified posts today, add the parameter date_query:

$today = getdate();

$args = array( 
'post_type' => 'post',
'post_status' => 'inherit', 
'orderby'     => 'modified', 
'order'       => 'DESC',
'posts_per_page' => -1,
'date_query' => array(
    array(
        'year'  => $today['year'],
        'month' => $today['mon'],
        'day'   => $today['mday'],
    )));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.