Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cptr_save() {
- global $post_ID;
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
- if (!isset($_POST['myplugin_noncename'])) return;
- if (!wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__))) return;
- if (!current_user_can( 'edit_post', $post_ID ) ) return;
- $id = $_POST['post_ID'];
- $related = isset($_POST['reladded']) ? $_POST['reladded'] : array();
- update_post_meta($id, CI_CPTR_POST_RELATED, $related);
- // this is where I attempt to update the post_type
- //Get a list of post IDs
- foreach ($related as $rel_id) {
- $my_post = array( 'id' => $rel_id, 'post_status' => 'publish');
- wp_update_post( $my_post );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement