Skip to content

Instantly share code, notes, and snippets.

@alokstha1
Created February 20, 2018 07:56
Show Gist options
  • Save alokstha1/1d8a76dccac6b0db9bccf32de0a3b690 to your computer and use it in GitHub Desktop.
Save alokstha1/1d8a76dccac6b0db9bccf32de0a3b690 to your computer and use it in GitHub Desktop.
Save_post conditions
<?php
add_action( 'save_post', 'cpm_resume_manager_save_resume', 10, 2 );
function cpm_resume_manager_save_resume($post_id, $post) {
if ( empty( $post_id ) || empty( $post ) || empty( $_POST ) ) return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( is_int( wp_is_post_revision( $post ) ) ) return;
if ( is_int( wp_is_post_autosave( $post ) ) ) return;
if ( $post->post_type != 'resume' ) return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment