Send to Telegram gets disabled by status changes

[ad_1]

Our site has a publishing process where posts go through a publishing queue. Something in the process turns off the “Send to Telegram” setting. Here’s how the process works:

1. Post is written and saved as pending to wait for approval.
2. Editor checks the post and saves it as spq_queued, a custom status.
3. Our scheduler picks up the post from the queue, changes the post status to future and sets the post_date.

Step 3 seems to turn off the “Send to Telegram” setting. Here’s what it does:

$updated_post = array(
	'ID'            => $post_id,
	'post_status'   => 'future',
	'post_date'     => date( 'Y-m-d h:i:s', $timestamp ),
	'post_date_gmt' => date( 'Y-m-d h:i:s', $timestamp - $gmt_offset ),
	'edit_date'     => true,
);

return wp_update_post( $updated_post );

Why does this turn off the setting? I suppose I can run the wp_update_posts() and, after that, set the send2tg custom field back to yes, but I’d also like to understand why this disables the setting. It shouldn’t, so maybe there’s a bug in the plugin?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer