• I need to have an action occur when a post is saved as a draft, but not when it’s published.
    Is there a way I can make a new action, ie: save_draft ?
    Or how would I alter either publish_post or edit_post to make either of them work only when a draft is saved? I’d sifted through the code but I’m having trouble understanding it all.
    thanks!
    graham

Viewing 1 replies (of 1 total)
  • Both actions pass the post ID to the called function. So, you can do something like this:
    function edit_post_callback($post_id) {
    $postdata = get_postdata($post_id);
    if ($postdata['post_status'] == 'draft') {
    // do stuff
    }
    }

Viewing 1 replies (of 1 total)
  • The topic ‘howto: publish_post action changed to draft?’ is closed to new replies.