1. add_action('save_post','heymap_post_save');
  2. function heymap_post_save($post_id) {
  3. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
  4. return;
  5.  
  6. if ( !wp_verify_nonce( $_POST['heymap_post_class_nonce'], plugin_basename(dirname(__FILE__)) ) )
  7. return;
  8.  
  9. if ( !current_user_can( 'edit_post', $post_id ) )
  10. return;
  11.  
  12. if ( is_numeric( $_POST["heymap-position-lat"] )) update_post_meta($post_id, "heymap-position-lat", $_POST["heymap-position-lat"]);
  13. if ( is_numeric( $_POST["heymap-position-lon"] )) update_post_meta($post_id, "heymap-position-lon", $_POST["heymap-position-lon"]);
  14. }
  15.  
  16. }