I’ve been making an attempt to alter the post_date and post_date_gmt through PHP just for Wooommerce Subscripptions utilizing a scheduler but it surely’s not being modified within the backend. Right here is the code I wrote and the frontend for it as properly.
What am I doing improper right here?
foreach ($schedules as $key => $schedule) {
$scheduledPost = get_post($key);
if (!empty($scheduledPost)) {
$originalDateTs = strtotime($scheduledPost->post_date);
$originalGmtDateTs = strtotime($scheduledPost->post_date_gmt);
$newDate = date("Y-m-" . $newDay . " H:i:s", $originalDateTs);
$gmtDate = get_gmt_from_date($newDate);
// Replace Submit
wp_update_post([
'ID' => $key,
'post_date' => $newDate,
'post_date_gmt' => $gmtDate
]);
Solely the day will will probably be chosen + 1month will probably be added by the code.