0

How to update automatically date time of page to current time only 1 time per day?

Example: I write a post on May 28, 2013. And if today is June 9, it will change may 28 to June 9. And if today is June 10, it will change June 9 to June 10.

How to do this? Thank you very much !

1

You're looking for wp_cron

if ( ! wp_next_scheduled( 'my_task_hook' ) ) {
  wp_schedule_event( time(), 'daily', 'my_task_hook' );
}

add_action( 'my_task_hook', 'my_task_function' );

And then you define my_task_function() updating the post date.

  • I am not coder. So can you give me a full code, please ? Thank you very much ! – Nguyen Jun 9 '13 at 2:27
  • pastebin.com/6sqXgvgR . Is it right ? Thank you ! – Nguyen Jun 9 '13 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.