Want more features on Pastebin? Sign Up, it's FREE!
Guest

Updating Custom Post Meta Issue 2

By: a guest on May 24th, 2012  |  syntax: None  |  size: 0.61 KB  |  views: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data