How to hook into publish post events in wordpress 4.7.5

Use {status}_{post_type} hook like:

function a_new_post( $postID, $post ) {
    // your awesome stuff goes here
}
add_action( 'publish_post', 'a_new_post', 10, 2 );

It will fire your action when post’s status will change from anything to ‘publish’.

tech