query($wpdb->prepare("DELETE FROM {$style_table} WHERE id = %d", $id)); } } if (!empty($_POST['duplicate']) && isset($_POST['id']) && is_numeric($_POST['id'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'imh_6310_nonce_field_duplicate')) { die('You do not have sufficient permissions to access this page.'); } else { $id = (int) $_POST['id']; $selectedData = $wpdb->get_row($wpdb->prepare("SELECT * FROM $style_table WHERE id = %d ", $id), ARRAY_A); $dupList = array( $selectedData['name'] . '-copy', $selectedData['css']); $wpdb->query($wpdb->prepare("INSERT INTO {$style_table} (name, css) VALUES ( %s, %s )", $dupList)); } } ?>