I need a query to show posts with same "publish date" as related posts. For Ex. if the post is published in 2012-08-02, i want to show other posts which are published in 2012-08-02 in bottom of the post. Is there any solution? Thank You.

1 Answer 1


Get the date of current post:

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

Get year, month and day from the $date variable.

$exploded = explode('-', $date);
$year = $exploded[0];
$month = $exploded[1];
$day = $exploded[2];

Lastly, query the posts that has the same publish date.

$args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'date_query' => array(
            'year'  => $year,
            'month' => $month,
            'day'   => $day,
$query = new WP_Query( $args );

Add any query arguments and display the query results as you wish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.