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.

I would like to ask how to disable the editing of time and date published? Also, I would like to ask if it's possible for people who doesn't own the blog to post, not just comment, but post their own posts in the blog. Please and thank you.

share|improve this question
1  
These are two very different Questions. Please open a new one for the issue "blog owner", thanks and welcome! –  brasofilo Nov 5 '12 at 13:42

1 Answer 1

There is no straightforward way to do this-- at least not one that I see. That is, there don't seem to be any hooks specifically intended for this task. You still have options though. This is what I'd do:

First, deny changes.

function deny_post_date_change( $data, $postarr ) {
  unset( $data['post_date'] );
  unset( $data['post_date_gmt'] );
  return $data;
}
add_filter( 'wp_insert_post_data', 'deny_post_date_change', 0, 2 );

You could add conditions for administrators if you wanted, or conditions for future posts, but the code as-is will completely remove any ability to edit the publication dates.

You will still see the form pieces though, so hide those with css.

function hide_publication_date_elements() { ?>
  <style type="text/css">
    a.edit-timestamp, #timestampdiv {display:none;}
  </style><?php
}
add_action( 'admin_enqueue_scripts', 'hide_publication_date_elements' );

These functions can go in your theme's functions.php or in a plugin.

share|improve this answer

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.