SHARE
TWEET

Untitled

a guest Jun 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter( 'wp_insert_post_data', 'se338236_change_date', 99 );
  2. function se338236_change_date( $data )
  3. {
  4.     //
  5.     // uncomment to apply changes only to selected post types
  6.  
  7.     //$types = [ 'PAGE', 'SOME_CUSTOM_POST_TYPE' ];
  8.     //if ( isset($data['post_type']) && in_array( $data['post_type'], $types ) {
  9.  
  10.         $data['post_date'] = $data['post_modified'];
  11.         $data['post_date_gmt'] = $data['post_modified_gmt'];
  12.  
  13.     //}
  14.     return $data;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top