WordPress.org

Ready to get started?Download WordPress

Forums

save_post hook help (post_status) (1 post)

  1. jspitz725
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to get the post_status of a post before it is updated in the database. If I hook into save_post, I'm hoping that the post_status will have already been changed to publish. Am I correct?

    Essentially, I have this hack where I modify the post content, but only when a post is published or updated. I don't want to modify the post content if the post is a draft or a preview or anything of that sort.

    How can I check this on the fly? I've tried get_post_status(''), but let's say I'm working on a draft...get_post_status('') == 'draft' and when I click publish, my code still considers it as a draft until the page gets refreshed (then it considers it as published).

    Sorry for the confusing question and thank you in advance for any help. I can clarify any questions.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic