• Resolved quasiDigi

    (@quasidigi)


    Hi,

    I would like to know if it’s possible to add a comment to a post before or while it’s published for the fist time.
    In my experience, I need to publish the post first and then I am able to add a comment. Is there a way to do both at once?

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Well, if you think about it… you can’t comment on a non-existing post 😀

    A comment needs a post to attach itself to. You might check out the AutomatorWP plugin to see if it’s possible with that.

    Moderator bcworkz

    (@bcworkz)

    How would code know what comment to make? Assuming code can access all the pertinent information, you could hook the “draft_to_publish” action and call wp_insert_comment() from the callback. The post object being published is passed to the callback so you can assure the comment is attached to the right post.

    Thread Starter quasiDigi

    (@quasidigi)

    @bcworkz
    Thank you, I will do some tests!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add a comment while publishing a post’ is closed to new replies.