Skip to content

Instantly share code, notes, and snippets.

@nydame
Created December 16, 2020 11:09
Show Gist options
  • Save nydame/bab8dba4d0aa5762a86082c329b868b3 to your computer and use it in GitHub Desktop.
Save nydame/bab8dba4d0aa5762a86082c329b868b3 to your computer and use it in GitHub Desktop.
<?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 );
@nydame
Copy link
Author

nydame commented Dec 16, 2020

This gist shows how to disable/enable WordPress' update of the post_modified and post_modified_gmt fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment