Sometimes you want to iterate on all posts that had some activity during the day, typically using WP_Query, the WordPress Query class. This is easy if all you want is to get the new posts but a little bit trickier if we also want the modified posts.
The following query takes advantage of the Date parameters of WP_Query, especially its relation property that allows us to concatenate (via AND or OR) query parameters to retrieve all WordPress posts published or modified in a given date, $today
in the example.
Note that date_parse
transforms a date in String format into an associative array where we can easily access the different components of the date (year, month, …).