janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Scheduled posts are not automatically shared #121

Open cybeardjm opened 1 month ago

cybeardjm commented 1 month ago

My settings: opt-in is on & delay = 120

I scheduled 2 posts and activated the "share on Mastodon" option for both posts. Both were normally published but didn't appear on my Mastodon TL.

When going back to edit the posts, they're still marked as activated, but no link below the box. Just saving/"Updating" the posts (no other change), sends them to Mastodon.

janboddez commented 1 month ago

Sounds like #98. Problem is I could not replicate. Maybe something's changed and it really is broken now.

In theory, when you click "Schedule," the checkbox value gets saved to the database.

Then when the post is published by WP's "WP-Cron functionality," the save_post_{$post->post_type} hook is run, which triggers crossposting. Same hook that's run when publishing right away.

janboddez commented 1 month ago

[T]he save_post_{$post->post_type} hook is run, which triggers crossposting[.]

Unless somehow the callback returns early, like for a ... REST request? Like, maybe the cron event got triggered and the callback returned early because of that?

I mean, just thinking out loud ...