/** * Dublicating survey AJAX * * @since 1.0.0 */ public static function ajax_duplicate_form() { $form_id = $_REQUEST['form_id']; $form = get_post($form_id); if ('questions' != $form->post_type) { return; } $form = new Questions_Form($form_id); $new_form_id = $form->duplicate(TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE); $post = get_post($new_form_id); $response = array('survey_id' => $new_form_id, 'post_title' => $post->post_title, 'admin_url' => site_url('/wp-admin/post.php?post=' . $new_form_id . '&action=edit')); echo json_encode($response); die; }