0

Мне необходимо задержать все публикующиеся записи на определенное время.

$time += 5400; 
$my_post = array(
      'ID'           => get_the_ID(),
    'post_date'    => date('Y-m-d H:i:s', $time),
      'post_status'  => 'future' ); 
    $my_post->edit_date = true;

wp_update_post( $my_post );

Но по каким то причинам это не работает.

1 ответ 1

0

Вот код который я искал

 $number_tesla = get_post_meta(get_the_ID(), 'erf', true);
$time = time();
 if (!$number_tesla){
 $number_tesla =gmdate("Y-m-d H:i:s",$time + 60 );
 update_post_meta(get_the_ID(), 'erf', $number_tesla);
  $my_post = array(
  'edit_date'   => true,
  'post_date'    => $number_tesla,
  'post_status'  => 'future' ,
  'post_date_gmt' => $number_tesla,
  'ID'           => get_the_ID()
  );   
wp_update_post( $my_post );
}

Если вдруг кому-то он понадобится

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.