Get all posts which was posted on X Days WordPress

I want to get all post which was posted on X Days, I don’t want 7 days old post or 1 Month old posts, Because it will return all posts which will be older 7 days or one month.
Like Today is 15 SEP, I want to get all posts which was post on 5 SEP.
Only 5 sep not older then 5 SEP. Only one Day posts.
I have try code like this

$args = array(
‘posts_per_page’ => -1,
‘post_type’ => ‘post’,
‘date_query’ => array(
‘after’ => date(‘Y-m-d’, strtotime(‘-10 days’))
)
);

But its return 10 days old posts.
Any help to get post for X days?
Thanks

Read more here:: Get all posts which was posted on X Days WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *