function kkb_backup_insert_entry_meta() { $result = array(); $post_id = sanitize_text_field($_POST['post_id']); $data = array('ID' => sanitize_text_field($_POST['ID']), 'board_id' => sanitize_text_field($_POST['board_id']), 'post_id' => $post_id, 'section' => sanitize_text_field($_POST['section']), 'related_id' => sanitize_text_field($_POST['related_id']), 'list_number' => sanitize_text_field($_POST['list_number']), 'depth' => sanitize_text_field($_POST['depth']), 'parent' => sanitize_text_field($_POST['parent']), 'type' => sanitize_text_field($_POST['type']), 'date' => sanitize_text_field($_POST['date']), 'guid' => sanitize_text_field($_POST['guid']), 'login_id' => sanitize_text_field($_POST['login_id']), 'writer' => sanitize_text_field($_POST['writer'])); $secret = null; $thumb = null; $attached = null; if (isset($_POST['secret'])) { $secret = sanitize_text_field($_POST['secret']); } if (isset($_POST['attached'])) { $attached = sanitize_text_field($_POST['attached']); } if (isset($_POST['thumbnail'])) { $thumb = sanitize_text_field($_POST['thumbnail']); } $meta = array('entry_id' => $post_id, 'kingkongboard_hits' => sanitize_text_field($_POST['hits']), 'kingkongboard_attached' => $attached, 'kingkongboard_secret' => $secret, '_thumbnail_id' => $thumb); include KINGKONGBOARD_ABSPATH . '/class/class.KKB_Backup.php'; $result = array(); $Recovery = new KKB_Backup(); $status = $Recovery->importKKBMeta($data); if ($status) { $result['status'] = 'success'; $Recovery->importEntryMeta($meta); } else { $result['status'] = 'failed'; } header("Content-Type: application/json"); echo json_encode($result); //echo print_r($meta); exit; }