Skip to main content
added 175 characters in body
Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

I think I know what happens here...

Most probably that Monday is another week - last one in 2018, and it makes sense. Last day of 2018 can’t be the first week of 2019 ;)

So I would query it in a different way:

'date_query' => array(
    'after' => '-' . (intval(date('N')) - 1) . 'days',
    'inclusive' => true
)

What it does is takes all posts published after given date. And to compute that date we take current day and substract the current day of the week - so we get last Monday...

I think I know what happens here...

Most probably that Monday is another week - last one in 2018, and it makes sense. Last day of 2018 can’t be the first week of 2019 ;)

So I would query it in a different way:

'date_query' => array(
    'after' => '-' . (intval(date('N')) - 1) . 'days',
    'inclusive' => true
)

I think I know what happens here...

Most probably that Monday is another week - last one in 2018, and it makes sense. Last day of 2018 can’t be the first week of 2019 ;)

So I would query it in a different way:

'date_query' => array(
    'after' => '-' . (intval(date('N')) - 1) . 'days',
    'inclusive' => true
)

What it does is takes all posts published after given date. And to compute that date we take current day and substract the current day of the week - so we get last Monday...

Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

I think I know what happens here...

Most probably that Monday is another week - last one in 2018, and it makes sense. Last day of 2018 can’t be the first week of 2019 ;)

So I would query it in a different way:

'date_query' => array(
    'after' => '-' . (intval(date('N')) - 1) . 'days',
    'inclusive' => true
)