Please read our complete guide on how to work with custom result redirect / landing pages in general, then head over to the GitHub link below to grab your free sample code.

Just a few lines – you can find a full example on GitHub.

$riddle = json_decode($_REQUEST['data']); 
    You played <strong><?php echo $riddle->riddle->title; ?></strong><br>
    with the RIDDLE ID <strong><?php echo $riddle->riddle->id; ?>
    <?php var_dump($riddle); /* debug complete data */ ?>

When working with result redirect pages in WordPress you need to add a PHP file outside of WordPress to capture the data. Unfortunately it is not possible to send data via POST to a WordPress page.

To build result redirect pages you need to:

  1. Create a PHP file to capture the data from the Riddle and upload that to a directory on your server outside of WordPress (in a sub directory called Riddle for example).
  2. Open a session and store the data you want to use on the custom result page in a session variable
  3. Redirect to the WordPress page where you want to display the results in your PHP
  4. Add PHP code to your landing page in WordPress to process the data from the session variable and display it

Below is sample code you can use to grab the data from a Riddle and pass that on to a WordPress page. This is the code we use on our sample site

The example on Pastafun is based on a quiz with 2 possible results “Amateur Cook” and “Pro Cook” and redirects based on the score of the Riddle. Anyone with a score of 0 or 1 is directed to the Amateur Cook landing page, anyone with a score of 2 goes to the Pro Cook. People with no score are redirected to the Amateur Cook page as a default. The score equals the number of correctly answered questions. There are lots of other score variables you could pick up from Riddle such as the score percentage, but I like to work off the number of correctly answered questions and use that to work out my own scale.

$riddle = json_decode($_REQUEST['data']);
$riddle_score = $riddle->resultData->scoreNumber;
$_SESSION['riddle_name'] = $riddle->lead2->Name->value;
switch ($riddle_score) {
    case '0':
    $redirectPage = 'amateur-cook';//just enter the page or post name here not the full URL and do not add .php or .html or anything like that
    case '1':
    $redirectPage = 'amateur-cook';//just enter the page or post name here not the full URL and do not add .php or .html or anything like that
    case '2':
    $redirectPage = 'pro-cook';//just enter the page or post name here not the full URL and do not add .php or .html or anything like that
    // Add as many cases as you you like. The result number equals the number of correctly answered questions. This allows you to do your own segmenting, without sticking to the strict segments that Riddle uses on the default quiz result pages.
 window.parent.location.href = '<?php echo $redirectPage;?>';//change this to the URL of your blog.

Best practices for testing and building your own result redirect page code

  • Use our pre-build result page to see all the data your Riddle generates. Follow these instructions on how to do that. This will give you all the data in an easy to read format.
  • Add a webhook to the Riddle to see all the data generated for each lead. The easiest way to do that is to generate a free webhook on

Either of the 2 methods mentioned above will allow you to pick up the correct syntax to find the value stored in the $riddle variable.

As usual, if you need any help, just reach out to us via chat or at

Make sure to also check out our free online course on how to build custom result pages on the Riddle Quiz Marketing Academy.

Leave a Comment