How to get the date of all blog posts

If you want to get the dates of all blog posts then you’ll need to perform your own query and loop that.

This is the query:

<?
$posts = new WP_Query(array(
    'post_type' => 'post',
    'posts_per_page' => -1
));
?>

Now you’ll need to loop those posts like so:

<?
if( $posts->have_posts() ) : while( $posts->have_posts() ) : $posts->the_post();
    echo get_the_date();
endwhile; endif;
?>

If you have 50 posts then you’ll see 50 dates.

If you need to make your query more specific to filter out certain posts then you can find all of the possible parameters with many code examples here.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)