divixmu
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [WPSiteSync for Content] Change target post timeI sent a ticket but no one seems to answer.
I am trying to change the publication date of the article and the featured image, but it seems to be unsuccessful ..
I tried with the code below, it changed the post date on the target page, but there was a problem. when I resynced though without changing anything it recreated the date of the post.
add_action('spectrom_sync_push_content', 'callback_function', 10, 3); function callback_function($target_post_id, $post_data, $response) { $time = current_time('mysql'); wp_update_post(array( 'ID' => $target_post_id, 'post_date' => $time, 'post_date_gmt' => get_gmt_from_date( $time ) )); }I also want the image directory to be changed to the current time zone when posts are synced.
Thanks
Forum: Plugins
In reply to: [WPSiteSync for Content] Change target post timeHello, I have tried your code to produce the result: Published
1970/01/01
I don’t know where it is wrong.add_action(‘spectrom_sync_push_content’, ‘callback_function’, 10, 3); function callback_function($target_post_id, $post_data, $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) )); }
Viewing 2 replies - 1 through 2 (of 2 total)