Closed ajvillegas closed 6 months ago
Thank you for the review @kadamwhite. I updated the function to use the save_post
hook instead since the wp_insert_post_data
doesn't run when publishing a new post.
I am still encountering some inconsistencies when testing. Mainly if I switch authors, or change the order, it doesn't seem to update the post data properly, but after some time it does. Is the data cache in the DB somehow? I've been testing with wp post get {ID}
to check the post_author
value.
However if I publish a post and remove myself as the author and add someone else before publishing it works consistently, and given that is the current workflow (an admin publishes someone else's post and adds them as the author), then it could satisfy the request.
I still need to test this on Dev with JetPack because I don't have a local email server setup with VIP Dev Env.
Dev-env comes with mailpit for testing email unless you opt out during environment setup, although I don't know how to use it. Maybe try the CLI --help command, or look through VIP docs? It also might not be possible if the email gets sent BY Jetpack on their end
As for the hook, I'd expect save_post to fire both on insert and update, as you say 🤔 alternatively, would it be sufficient to fire when a post is moved from draft to publish with transition_post_status
This change tries to fix the post author in the JetPack email notifications by updating the
post_author
with the first Co-Authors Plus plugin author assigned to a post. This assumes that JetPack is looking for thepost_author
value when creating the email notification for a post.To Do:
Testing Instructions:
post_author
with the following command:wp post get {ID}
replacing{ID}
with the post ID you copied above.post_author
value contains the ID of the guest author and not yours.For humanmade/wikimedia#887