Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function daz_custom_field_on_publish( $new, $old, $post ) {
  2.  
  3. $unixtime = date(strtotime("+1 week"));
  4. $now = date("m/d/Y",$unixtime);
  5.  
  6. if ( $new == 'publish' && $old == 'pending') {
  7. update_post_meta( $post->ID, '_post_expiration_date', $now );
  8. }
  9. }
  10. add_action( 'transition_post_status', 'daz_custom_field_on_publish', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement