Open Zodiac1978 opened 3 months ago
@dkotter @peterwilsoncc We can update the pull filter code like this, since while pulling, we only clone date if post_status
is future
:
/**
* This filters the the arguments passed into wp_insert_post during a pull
*/
add_filter( 'dt_pull_post_args', function( $post_array, $remote_id, $post ) {
// Date carry forward is only possible on scheduled post
if ( ! isset( $post_array['post_status'] )
|| 'future' !== $post_array['post_status'] ) {
return $post_array
}
$post_array['post_date'] = $post->post_date;
$post_array['post_date_gmt'] = $post->post_date_gmt;
return $post_array;
}, 10, 3 );
Describe the bug
I added the snippet from here: https://10up.github.io/distributor/tutorial-snippets.html#push-original-publication-date
Pushing a post does leave the date intact, but pulling it, does not.
Steps to Reproduce
Screenshots, screen recording, code snippet
The headline says "Push original publication date", but as there is an additional function using
dt_pull_post_args
I assumed this is the code for pulling.If not, a new snippet would be great. Or repair the existing one (and fix the headline ;) )
Environment information
No response
WordPress information
WordPress 6.5.2
Code of Conduct