WordPress: aggiornare la data di un post

In questo articolo vedremo come aggiornare la data di un post in WordPress.

WordPress di Gabriele Romanato

In questo articolo vedremo come aggiornare la data di un post in WordPress.

La soluzione รจ la seguente:


$post_id = 29;
$new_post_date = '2022-12-01 12:00:00';

$args = [
  'ID' => $post_id,
  'post_date' => $new_post_date,
  'post_date_gmt' => get_gmt_from_date( $new_post_date )
];

wp_update_post( $args );