Advertisement
mightypixel

cptr_save

Jun 5th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. function cptr_save() {
  2.     global $post_ID;
  3.  
  4.     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
  5.     if (!isset($_POST['myplugin_noncename'])) return;
  6.     if (!wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__))) return;
  7.     if (!current_user_can( 'edit_post', $post_ID ) ) return;
  8.  
  9.     $id = $_POST['post_ID'];
  10.     $related = isset($_POST['reladded']) ? $_POST['reladded'] : array();
  11.     update_post_meta($id, CI_CPTR_POST_RELATED, $related);
  12.    
  13.  
  14.     // this is where I attempt to update the post_type
  15.  
  16.         //Get a list of post IDs
  17.        foreach ($related as $rel_id) {
  18.         $my_post = array( 'id' => $rel_id, 'post_status' => 'publish');
  19.         wp_update_post( $my_post );
  20.        }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement