Replies: 0
Hello,
I use the “save_post” hook to do something when a post gets saved. But the hook get instantly called when I click on “new post” button in my backend. I only want to do the stuff when a real post gets saved.
// Autosave, do nothing
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// AJAX? Not used here
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
return;
// Check user permissions
if ( ! current_user_can( 'edit_post', $post_id ) )
return;
// Return if it's a post revision
if ( false !== wp_is_post_revision( $post_id ) )
return;
// my stuff