public static function ajax_clone_email() { $id = $_POST['id']; $name = $_POST['name']; $new_email_id = FUE::clone_email($id, $name); if (!is_wp_error($new_email_id)) { $resp = array('status' => 'OK', 'id' => $new_email_id, 'url' => 'admin.php?page=followup-emails-form&step=1&id=' . $new_email_id); } else { $resp = array('status' => 'ERROR', 'message' => $new_email_id->get_error_message()); } die(json_encode($resp)); }