Skip to content

Instantly share code, notes, and snippets.

@keesiemeijer
Created March 3, 2014 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keesiemeijer/9320762 to your computer and use it in GitHub Desktop.
Save keesiemeijer/9320762 to your computer and use it in GitHub Desktop.
WordPress: Checks if new post is created
<?php
/**
* Checks if post status is new
*/
add_action( 'transition_post_status', 'post_unpublished', 10, 3 );
function post_unpublished( $new_status, $old_status, $post ) {
if ( $old_status == 'new' ) {
// do stuff for new post
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment