Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created May 17, 2014 21:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/62ab0d09ca28d3e6fc7e to your computer and use it in GitHub Desktop.
Save thomasgriffin/62ab0d09ca28d3e6fc7e to your computer and use it in GitHub Desktop.
Add email and name as query args to the success redirect page in OptinMonster.
<?php
add_filter( 'optin_monster_conversion_data', 'tgm_om_modify_conversion_data', 10, 2 );
function tgm_om_modify_conversion_data( $data, $object ) {
// If there is no redirect, do nothing.
if ( empty( $data['redirect'] ) ) {
return $data;
}
if ( isset( $object->email ) && $object->email ) {
$data['redirect'] = add_query_arg( 'email', $object->email, $data['redirect'] );
}
if ( isset( $object->name ) && $object->name ) {
$data['redirect'] = add_query_arg( 'name', $object->name, $data['redirect'] );
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment