/** * Save the meta when the post is saved. * * @param int $post_id The ID of the post being saved. */ public function save($post_id) { /* * We need to verify this came from the our screen and with proper authorization, * because save_post can be triggered at other times. */ // Check if our nonce is set. if (!isset($_POST['emrede_meta_inner_custom_box_nonce'])) { return $post_id; } $nonce = $_POST['emrede_meta_inner_custom_box_nonce']; // Verify that the nonce is valid. if (!wp_verify_nonce($nonce, 'emrede_meta_inner_custom_box')) { return $post_id; } // If this is an autosave, our form has not been submitted, // so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check the user's permissions. if ('emrede' == $_POST['post_type']) { if (!current_user_can('edit_emrede', $post_id)) { return $post_id; } } else { return $post_id; } /* OK, its safe for us to save the data now. */ EmRede::save_fields($post_id); if (array_key_exists('thumbnail2', $_POST)) { update_post_meta($post_id, 'thumbnail2', $_POST['thumbnail2']); //TODO more sec } if (array_key_exists('thumbnail3', $_POST)) { update_post_meta($post_id, 'thumbnail3', $_POST['thumbnail3']); //TODO more sec } if (array_key_exists('thumbnail4', $_POST)) { update_post_meta($post_id, 'thumbnail4', $_POST['thumbnail4']); //TODO more sec } if (function_exists('mapasdevista_save_postdata')) { mapasdevista_save_postdata($post_id); } }