function reset_post_date_wpse_121565($data,$postarr) { // var_dump($data,$postarr); die; // debug $data[‘post_date’] = $data[‘post_modified’]; $data[‘post_date_gmt’] = $data[‘post_modified_gmt’]; return $data; } add_filter(‘wp_insert_post_data’,’reset_post_date_wpse_121565′,99,2);
function reset_post_date_wpse_121565($data,$postarr) {
// var_dump($data,$postarr); die; // debug
$data['post_date'] = $data['post_modified'];
$data['post_date_gmt'] = $data['post_modified_gmt'];
return $data;
}
add_filter('wp_insert_post_data','reset_post_date_wpse_121565',99,2);
add the code to theme functions.php or create a plugin,
upload to wordpress read more at create wordpress custom plugin
<?php
/*
Plugin Name: test plugin
Plugin URI: https://www.test.com
Description: A short little description of the plugin.
Version: 1.0
Author: test
Author URI: https://www.text.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wp
Domain Path: /languages
*/
<?php
/*
Plugin Name: test Tutorial
Plugin URI: https://www.tt.com
Version: 1.0
*/
<?php
/*
Plugin Name: Auto date change on update
Plugin URI: https://www.raazkumar.com
Version: 1.0
*/
function reset_post_date_wpse_121565($data,$postarr) {
// var_dump($data,$postarr); die; // debug
$data['post_date'] = $data['post_modified'];
$data['post_date_gmt'] = $data['post_modified_gmt'];
return $data;
}
add_filter('wp_insert_post_data','reset_post_date_wpse_121565',99,2);