code: public function can_save_post_meta( $post_id, $action, $nonce ) {
  
          $is_autosave = wp_is_post_autosave( $post_id );
          $is_revision = wp_is_post_revision( $post_id );
          $is_valid_nonce = ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], $action ) );
  
          return ! ( $is_autosave || $is_revision ) && $is_valid_nonce;
  
      }
docs: Determines whether or not post meta can be saved.
  
  @param int $post_id The id of the post being saved.
  @param string $action The feature's action.
  @param string $nonce The feature's nonce.
  @return boolean Whether the post meta can saved or not.