i want to get the ID from the post table where the post_modified date is exactly 5day ago. and foreach ID i get i will do another call another function. i know i have to add a loop somewhere but mybrains hurts when it comes to looping please help!
i have 3 example records to compare date.
{
status: "ok",
post: [
{
ID: "99",
post_modified: "2015-09-02 07:58:14"
},
{
ID: "100",
post_modified: "2015-09-04 02:59:27"
},
{
ID: "101",
post_modified: "2015-09-09 07:36:56"
}
]
}
this is myfunction code
public function test(){
global $wpdb;
$data= $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_status like 'wc-completed' AND post_modified < DATE_SUB(now(), INTERVAL 5 DAY)");
return $data;
}
ok i solved it for getting correct data base on 5 day interval