Created
December 16, 2020 11:09
-
-
Save nydame/bab8dba4d0aa5762a86082c329b868b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function stop_modified_date_update( $new, $old ) { | |
$new['post_modified'] = $old['post_modified']; | |
$new['post_modified_gmt'] = $old['post_modified_gmt']; | |
return $new; | |
} | |
add_filter( 'wp_insert_post_data', 'stop_modified_date_update', 10, 2 ); | |
// do stuff that updates post(s) here | |
remove_filter( 'wp_insert_post_data', 'stop_modified_date_update', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist shows how to disable/enable WordPress' update of the
post_modified
andpost_modified_gmt
fields.