Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 !

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
I am not coder. So can you give me a full code, please ? Thank you very much ! –  Nguyên Bama Jun 9 '13 at 2:27
    
pastebin.com/6sqXgvgR . Is it right ? Thank you ! –  Nguyên Bama Jun 9 '13 at 2:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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