Forums

Publish_post ... any way to modify? (3 posts)

  1. ebedgert
    Member
    Posted 2 years ago #

    I've been using a plugin which uses "publish_post" to send an e-mail to the post author when the post is published. Unfortunately, this means it also sends an e-mail to the author any time his published post is updated. Is there any way to avoid this? I'd just like it to send an e-mail only on the initial publishing of the post.

  2. ebedgert
    Member
    Posted 2 years ago #

    OK, I went back and looked through some old posts and the Codex like you're supposed to :-)

    I did find a solution here to the first problem, but I have kind of an unusual second problem. I am using another plugin that allows me to define custom post statuses other than "Draft" or "Pending." These custom post statuses are important for me to retain, so I can't drop them. Unfortunately, when I use the three alternate hooks mentioned in the thread I've linked to, they don't recognize my custom statuses, and the e-mail send does not get triggered.

    Instead of

    add_action('draft_to_publish','function_name');

    I need something like

    add_action('readytopublish_to_publish','function_name');

    ("Ready to Publish" is the name of one of my custom statuses)

    Any way around this problem?

  3. Arpit
    Member
    Posted 1 year ago #

    I also had issue with my plugin Twitter Goodies.

    I figure out that issue by putting 2 different conditions. Please check out here: http://arpitshah.com/publish_post-how-to-check-if-wp-post-is-newly-published-or-edited/

    I hope it will help you.

Topic Closed

This topic has been closed to new replies.

About this Topic