WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have about 60 posts queued and ready to post on specific dates, but I forgot to set the post time. I really don't want a bunch of posts posting at 3AM, so I need to change the times on all these posts.

Is there any way to do this, programmatically or with a plugin?

share|improve this question

If you have the id of the posts, you can use wp_update_post and change the post_date.

foreach ($postId as $id) {
  // random hour and time. You can also manually set these.
  $h = rand(1, 23);
  $i = rand(0, 59); 

  $newDate = array(
    'ID' => $id,
    'post_date' => "2013-12-19 $h:$i:59" // [ Y-m-d H:i:s ]

share|improve this answer
So, I just stick this in a new php file, or where should I stick this? Cheers – user2274612 Dec 19 '13 at 17:44

Your Answer


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.