How to filter posts by specific date and its tag

Question

I want to show the post dates of posts which is greater than $postdate value.
what is the wrong with the following code?

Instead of filtering the data by dates, it shows all the dates. I do not know what the problem is with the logic.

Any help will be most appreciated.

<?php 

                  $postdate =  get_the_date('Y-m-d');


          $update = new WP_Query(array(
      'posts_per_page' => -1,
       'post_type' => 'post',
        'meta_key' => 'post_date',
        'orderby' => 'meta_value_num',
        'order' => 'ASC' ,
        'meta_query' => array(
                array(
                     'key' => 'post_date',
                     'compare' => '>',
                     'value' => $postdate,
                     'type' => 'numeric'
             )
       )    
));


         while ($update->have_posts()) {
          $update->the_post();  ?>
             <p class="center">
                <span><a href="<?php the_permalink(); ?>"><?php the_title();  ?></a></span><br>
               <span class="small"><i><?php  the_date();  ?></i></span></p>
 <?php     }       


      ?>

 </div>


<div>
0
, Ashur 2 years 2020-01-05T09:41:59-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse