How to import CSV quizzes with the same custom settings?

closed

Hello,

I am using HD Quiz and I create new quizzes by importing a CSV file. The import always creates a completely new quiz.

My question is: is there any way to make a newly imported quiz inherit the same custom settings as an existing quiz, or to change or save the default settings used for new imported quizzes?

At the moment, the questions can be imported easily with CSV, but the quiz-specific custom settings do not seem to come along. Duplicating an existing quiz keeps the settings, but then replacing all questions manually is quite time-consuming.

Is there any supported way to:

import questions from CSV into an existing quiz without creating a new one,
copy custom settings from one quiz to another,
include quiz settings in the CSV import somehow, or
change or save the default settings used when a new quiz is created by import?

My goal is to use one quiz as a template and then create new quizzes with the same settings but different questions.

 

Thanks.

April 22, 2026 at 10:55amTeppo Hirvikunnas

Hi Teppo,
first, it is on my todo list to add a “global default” quiz settings page to HD Quiz in the future – but this is not something that is currently a priority so I cannot provide a timeline on when I’ll be able to add it in – but it IS something I agree would be useful for users like you!

The good news is that it is still possible to set global quiz settings. The bad is that it requires a bit of coding on your end.

I have a filter called hdq_before_quiz_data that allows us to change the quiz settings just before the quiz prints. You can use this filter to set any options or settings you want globally. Since HD Quiz has so many options and settings, I can’t go over everything, but here is a rough idea of how you could use this.

 

add_filter("hdq_before_quiz_data", function ($data) {
    echo '<pre>';
    print_r($data["quiz"]);
    echo '</pre>';
    return $data;
});

If you added the above code to your theme’s functions.php file (BACKUP THE FILE FIRST), then it will simply print out a list of your current quiz settings for your reference – but you can also modify them here if you wish.

 

For example:

 

add_filter("hdq_before_quiz_data", function ($data) {    
    $data["quiz"]["quiz_pass_percentage"] = 100;
    return $data;
});

would set all quizzes to require 100% pass percentage.

 

If you only want to override certain quizzes, you can check against the quiz_id.

 

add_filter("hdq_before_quiz_data", function ($data) {
    $validQuizzes = array(45, 46, 47, 88); // only change settings if one of these quizzes
    if (in_array($data["quiz"]["quiz_id"], $validQuizzes)) {
        $data["quiz"]["quiz_pass_percentage"] = 100;
    }
    return $data;
});

The above would only change the settings for quizzes with IDs that match $validQuizzes.

 

I know that this can seem like a lot, especially if you are not a “techie”, but unfortunately, this would be the best way to set global settings for the time being. Feel free to ask for any further help or support with this!

22 April 2026 — 14:52support admin Dylan

Hello,
Thank you for the clear explanation. That helps clarify the current situation.
Yes – My webmaster can do these
 
I have a couple of follow-up questions:

Is there any documentation or reference showing which quiz parameters can be changed through hdq_before_quiz_data, and what their exact parameter names are, such as quiz_pass_percentage?
Can the content of Quiz Pass Content and Quiz Fail Content also be set this way, so that a default custom text (empty) would apply automatically to new imported quizzes?
Is there any supported way to duplicate an existing quiz, including all of its settings, and then use that duplicate as a template for a new quiz?

My goal is still to build a practical template workflow, where new quizzes can be created with the same settings and only the questions would change.
Thanks again.Teppo Hirvikunnas

22 April 2026 — 15:20Teppo Hirvikunnas

The first example will print out all of the setting names and current values, so your webmaster will have no issues connecting everything. This is for ALL quiz settings, including the pass/fail content 🙂

22 April 2026 — 15:49support admin Dylan

Thanx! 

23 April 2026 — 01:49Teppo Hirvikunnas

Hello,
It seems that this does not work as expected.
We implemented the hdq_before_quiz_data filter to force global quiz settings for all quizzes, while leaving quiz_id, quiz_name, and rename_quiz untouched.
However, in practice the forced settings do not seem to apply correctly.
At the moment:

there is no pagination
correct / incorrect marking does not appear
pass / fail content does not appear

So it seems that something is wrong either in the way we are using the filter, or in which quiz parameters should actually be changed.
This is the code we are using:

 

add_filter(“hdq_before_quiz_data”, function ($data) { $data[“quiz”][“quiz_pass_percentage”] = 100; $data[“quiz”][“hide_questions_after_completion”] = “yes”; $data[“quiz”][“quiz_pass_content”] = ‘<h3 style=”text-align: left;”><span style=”color: #ff0000;”><strong>Loistavaa!</strong></span><span style=”color: #ff0000;”><strong>Olet todellinen guru.<a href=”https://staging.avplus.site/wp-content/uploads/Voittaja-mitalli-kyselyyn.png”&gt;&lt;img class=”alignnone wp-image-90130 size-thumbnail” src=”https://staging.avplus.site/wp-content/uploads/Voittaja-mitalli-kyselyyn-150×150.png” alt=”” width=”150″ height=”150″ /></a></strong></span></h3>&nbsp;’; $data[“quiz”][“quiz_fail_content”] = ‘<p style=”text-align: left;”><span style=”color: #000000;”>80–99 % = Erinomainen tulos! – Aihe hyvin hallussa</span><br>70–79 % = Hyvä – Aihe on selvästi tuttu<br>50–69 % = Kohtalainen perustuntemus<br>30–49 % = Hmm – Ihan ok, but…<br>1–29 % = Arvaamalla saatu?<br>0 % = Tämä on jo saavutus 😉</p>’; $data[“quiz”][“mark_questions”] = “yes”; $data[“quiz”][“mark_answers”] = “yes”; $data[“quiz”][“immediately_mark_answers”] = “yes”; $data[“quiz”][“stop_answer_reselect”] = “yes”; $data[“quiz”][“force_show_extra_content”] = “yes”; $data[“quiz”][“force_answers”] = “yes”; $data[“quiz”][“share_quiz_results”] = “yes”; $data[“quiz”][“results_position”] = “below”; $data[“quiz”][“paginate_all”] = “yes”; return $data;});

 

Could you please confirm:

whether hdq_before_quiz_data is the correct filter for changing these front-end quiz settings,
whether these parameter names are correct for the current version of HD Quiz,
and whether some of these settings need to be changed somewhere else instead?

Because based on testing, it seems that these overrides are not actually taking effect on the quiz output.
Thanks.
 
Jos haluat, voin tehdä tästä vielä lyhyemmän version.

25 April 2026 — 10:13Teppo Hirvikunnas

Hi Teppo, please use the Code Block in the future when pasting large amounts of code. It’s impossible for me to know if you have a formatting issue, or if the sanitization is changing characters for you.

All I can say right now is that

  • hdq_before_quiz_data is 100% the right filter. It works.
  • Where are you adding this code? It needs to be either added as a plugin itself, or to your theme’s functions.php file. If you are using some code snippet plugin it probably won’t work because the code snippet plugin runs too late
  • Only change the settings you want to actually change – no need to override everything.

Here is a 100% working example with some of your settings already included

</>
hdq_before_quiz_data ExampleView Code
25 April 2026 — 11:24support admin Dylan

We used the snippet – the problem might be that.
I just want to confirm what you meant by this part of your reply:

“It needs to be either added as a plugin itself, or to your theme’s functions.php file.”

Do you mean that this code should be placed in:

a small separate custom WordPress plugin of our own, or
the child theme’s functions.php file?

We want to make sure that the changes will not be overwritten during future updates.
So we especially want to confirm that you do not mean editing the HD Quiz plugin files directly, because those changes would likely be lost when the plugin is updated.
I assume you mean a separate custom plugin, or alternatively the child theme’s functions.php, but I just want to make sure we understood this correctly.
 
Thanks.

26 April 2026 — 06:07Teppo Hirvikunnas

Your understanding is correct 

26 April 2026 — 14:31support admin Dylan

This thread has either been marked as complete or has been automatically closed due to inactivity. Please consider opening a new support thread for help.