WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Check if post is being published for the first time, or is an already published post being updated

I'm writing a plugin which needs to grab posts as their published from one blog - but I'm finding that despite using the requirement that they be published and not revisions, when the post is updated, it's sending across a duplicate.

Is there any way to determine whether a post has been published and is being updated? My alternative is to add a custom post meta field which says its already been grabbed by the plugin - but this isn't ideal in comparison to a solution that requires no additional fields.

share|improve this question

marked as duplicate by toscho Jul 9 '12 at 18:25

This question was marked as an exact duplicate of an existing question.

add_action( 'save_post', 'your_action' );

function your_action( $post_id ) {

    if ( !wp_is_post_revision( $post_id ) ) {
        // Do this only if not a revision

Use the if condition to check if post is not revision.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.