Hello divixmu,
Thank you for your interest in WPSiteSync.
There is a way you can do this. An action hook is called after WPSiteSync finishing updating a post on the Target. You can use this hook to modify the date:
add_action(‘spectrom_sync_push_content’, ‘callback_function’, 10, 3);
/*
* @param $target_post_id int The Target’s post ID
* @param $post_data Array The post data being updated
* @param $response SyncApiResponse The response object for the current API call
*/
function callback_function($target_post_id, $post_data, SyncApiResponse $response)
{
$new_post_date = strtotime($post_data[‘post_date’]);
$new_post_date += 2 * 60 * 60;
wp_update_post(array(
‘ID’ => $target_post_id,
‘post_date’ => date(‘Y-m-d H:i:s’, $new_post_date)
));
}
This example will add 2 hours to the post_date column, adjusting for instance from GMT-8 to GMT-6. If you need a different adjustment, you can add or subtract any other amount that you need.
One thing to note: This is something that we will be handling automatically in the future. The Timezone setting on the Source site will be compared to the Timezone setting on the Target site and used to adjust the post_date and post_modified columns automatically. When this feature is enabled, your callback function will no longer be needed.
All the best,
The ServerPress Team