Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Example 1: Cancel the action if WordPress is doing autosave.
- add_action( 'save_post', function( $post_id ){
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { // WordPress is doing autosave.
- return; // cancel your action
- }
- //...your action here...
- } );
- // Example 2: Cancel the action if WordPress is doing autosave and that the
- // post has been successfully autosaved...
- add_action( 'save_post', function( $post_id ){
- if (
- ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) && // WordPress is doing autosave
- wp_is_post_autosave( $post_id ) // and the autosave succeeded.
- ) {
- return; // cancel your action
- }
- //...your action here...
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement