How to Create Personality Assessment Type Quizzes Using Gravity Forms Plugin

Listen to this article

quiz-bannerHave you taken the ‘What kind of X are you’ quiz? I have.

Most of the times you can predict the result and manipulate it. Nevertheless, it is just as fun. It basically is a very crude personality assessment quiz. The answers are multiple-choice and are always displayed in a particular order. The results are based on the answers you choose.

So, say there are 4 choices for each result (a,b,c,d). Mostly a’s would mean you are type A, mostly b’s would mean you are type B, and so on. Optionally the answers have weights, and you evaluate based on your score. You get the idea.

If you have no clue on how to add such a quiz on your WordPress or LearnDash website, I’d suggest you search for a plugin. A suitable solution would really depend on your requirements. But, if you want total control on the functionality you’ll be better off building it yourself or having it custom-built by professionals.

I’ll warn you right away, that there will be some code involved. Don’t stress. But, code is not scary. Once you have the logic in place, coding is a breeze.

Here’s what we’ll need to do:

  1. Get the Gravity Forms plugin (if you do not already have it)
  2. Create an Assessment Type Quiz
  3. Evaluate and Display Results


Why Gravity Forms?

We’ll be using the Gravity Forms plugin as a base for the quiz. The reason we have selected the Gravity Forms plugin is that it reduces the effort by- a LOT!

You see, the functionality you need is readily available. You have an option to add radio buttons, and also to effortlessly split the questions across sections to create a multi-part form. (This will be clear when we actually create the form).

You have the option to store results in a hidden field, style the form as per your theme, allow notifications to be sent on form submission, as well as the option to process values using available hooks.

You basically have your job cut out.

[su_note note_color=”#EDEDED”]


If you’re trying to achieve something like this on your LearnDash website, there’s a workaround you should know about.


The default multiple-choice quiz question type in LearnDash will allow you to create the questionnaire. Once you have the questions ready, you can assign weights, points or a score to the options and have the suitable assessment displayed. 

If you choose to go ahead using this method, you need not use the Gravity Forms plugin at all.


How to Create the Quiz?

Since we will be essentially creating a quiz, some of you might be wondering if we will be using the Quiz Add-on for Gravity Forms. We won’t be using this add-on, because it doesn’t help us. This add-on is focussed on creating examination type quizzes, and instead of tweaking it, we’d be better off creating our own solution.

Moving on.

For every quiz we create, we have to create a new form. As an example, let’s consider we want to create a ‘Which Superhero are you’ quiz.

Step 1: We’ll have to create a new form and name it ‘Which Superhero are you’.

Step 2: Each question will have to be added as a ‘Radio Buttons’ field. Add the question as the field name, and options as possible answers.

Step 3: To assign weights to each answer, check the ‘show values’ checkbox for the field, and add values.

Creating the Quiz

Step 4: If every question has to be answered, make each question a required field.

Step 5: To format the display of the form, you can choose to create a multipart form, and add a question on every section. For this, you would need to add a ‘Page Break’ field after every question.

Step 6: We’ll also be using a hidden field to store the result. This will be used once the form is filled but before notifications are sent. Add this field at the end of the form in the last section.

Adding a Hidden Field

Once you have the fields in place, save the form. Pay attention to the form and field ids, we will be needing these in our code.


How to Evaluate and Display Results?

Now, we’ve come to the main point. We have to evaluate inputs and display the corresponding results. For this we need to use the gform_pre_submission’ hook. Using this hook, we can calculate the aggregate of the results and update the hidden field value, before the form entries are saved.

Lets consider you’ve added 5 questions, and the sixth field is the hidden field. Since we have assigned a value to each field, we would have to calculate the total of all selected fields and show the result based on the total. In the $_POST variable, the key for each field would be input_{field_id}. For example, for field id 4, the value would be $_POST[“input_4”];

add_filter("gform_pre_submission_3", "wdm_evaluate_results");

function wdm_evaluate_results($form)
    $total = 0;

    // add the values of selected results
    $total += $_POST["input_1"] ;
    $total += $_POST["input_2"] ;
    $total += $_POST["input_3"] ;
    $total += $_POST["input_4"] ;
    $total += $_POST["input_5"];

    // set the value of the hidden field
    $_POST["input_6"] = $total;

Now that we have the result, we can display a message using the confirmation notification settings for the form, and by using some conditional logic.

How to Display Results

In continuation with our example, say you are ‘Batman’ if your score is less than 30. In that case you have to add a confirmation, which will be displayed only if the value of the hidden field is less than 30.

And you’re set! You have your own personal assessment quiz.

Wrapping Up

A majority of our clients who’re always looking to upgrade the quizzing modules of their site are primarily LMS and LearnDash website owners. If you’re one of them, here’s something that might interest you.

[su_note note_color=”#EDEDED”]

Further Reading on ‘LearnDash Quiz Customization’

DIY Customization Tricks for your LearnDash Quizzes


That’s all for today. Be sure to try it out and send me links of the assessment quizzes you create using the comment section below!





21 Responses

  1. This looks awesome! Just what I was looking for.

    If less then 30 is ‘Batman’.. Does it mean that you can only make a result based on a numeric value? It seems strange to me, since the different types of Super heroes should all be equal to eachother – just different.
    What is your view on this?

    1. Hi Thomas,

      The score does not indicate the value of the super hero. It just acts as a differentiator. You needn’t display the score to the user, just the result.

      ps:- If I had to score super heroes by their value, Batman would clearly win :-p

  2. Can you create a personality quiz which allows you to answer from extremely unlikely to extremely likely?

    1. Hi Sonia,

      Yes. You can change the answers accordingly. Also, take a look at the WP Pro Quiz plugin. It has such a feature.

  3. i’m loving this gravity quiz plugin. Except for one thing, I need to award users several points for each completed quiz, as well as restrict them from doing the same quiz over again. Is this possible with this addon?

    1. Hi Henk,

      You can try using the gform_after_submission hook to assign the user points. If the user is logged in, you can save points assigned as user meta. Regarding preventing a user from retaking the quiz, you can take a look at this GF support thread. (The thread is old, but the solution can still holds good).

  4. Sorry, I’m a bit lost. Where exactly do I paste the add_filter(“gform_pre_submission_3”, “wdm_evaluate_results”); code? Thank you!! 🙂

    1. Hi Migs,

      You need to add the code in functions.php of your child theme or a site-specific plugin. 🙂

  5. Hey, sorry about my question. I was being blonde! :/

    Say you wanted to show the scores in the confirmation, and that you wanted to compare before and after results (or 2 sets of results from the same quiz taken at different times)… any tips for that?

    Thank you!! 🙂

    1. Hey,

      This is not something I’ve explored! I see you’ve sent us a mail as well. Someone from the Biz Dev team will surely contact you. 🙂

  6. This is really wonderful, thanks. The only thing I’m missing is the ‘Enable answer explanation’ function in GF Quiz Add-On, where an explanation for the right answer can be added to each field and displayed when the user answers a question. Can you suggest a way to go about adding this feature to your solution? Much appreciated.

    1. Hi,

      What you can do is add a ‘Paragraph Text’ field, and add conditional logic to display it based on the answer being selected.

      I hope that works for you.

  7. is it possible to have 3 or more forms using this technique. In each confirmation it gives a link to the next quiz. Then after they complete all of the quizzes you use a function to populate an overall score?

    1. It’s certainly possible Heather. But there could be a bit of development involved, especially to calculate the results. Simple settings might not suffice.

  8. Hi, I have used gravity forms quiz for a while now. What I need to know is if anyone has come across a way to implement a leaderboard front facing option for the quiz where it shows the top scorers in order.
    Ideally it would also then need to be cumulative monthly.


Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads

    Don't Settle for Less - Learn How to Choose the Right WordPress Plugin Developer.

    Get your hands on invaluable advice and recommendations. Download our free guide to make informed decisions when hiring a WordPress plugin Developer and maximize your ROI