save_post problem with auto-save
-
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
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘save_post problem with auto-save’ is closed to new replies.