Written by Anonymous
add_action( 'save_post', function( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
$transient_id = TRANSIENT_AMP_PREFIX . $post_id;
$transient_file = get_theme_amp_cache_path() . $transient_id;
if ( file_exists( $transient_file ) ) {
wp_filesystem_delete( $transient_file );
delete_db_cache_records( $transient_id );
}
});