Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of how to redirect after survey submission for the Awesome Surveys WordPress plugin. Requires Awesome Surveys version > 1.1.1
<?php
/*
Plugin Name: Custom Redirect for Awesome Surveys
Plugin URI: http://www.willthewebmechanic.com/awesome-surveys
Description: Redirects to a specified link after survey submission
Version: 1.0
Author: Will Brubaker
Author URI: http://www.willthewebmechanic.com
License: GPLv3.0
*/
add_filter( 'after_awesome_survey_response_processed', 'wwm_after_survey_redirect', 10, 2 );
/**
* Filters the URL
* @param string $url the url that is being filtered
* @param array $args an array of arguments. At the time of creation this array contained
* 'survey_id' which is, well, the id of the survey being processed
* 'survey' which is the survey that was responded to and 'responses' which
* is a copy of the 'questions' array that was posted i.e. $_POST['question']. Use these values to decide
* where to redirect to or return null if not re-directing.
* @return string the filtered url
* @since 1.0
* @author Will the Web Mechanic <will@willthewebmechanic.com>
*/
function wwm_after_survey_redirect( $url = null, $args = array() )
{
$url = 'http://www.willthewebmechanic.com';
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.