SHARE
TWEET

Untitled

a guest Mar 20th, 2017 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 );
RAW Paste Data
Top