Randomize answer working – Randomize Questions NOT WORKING?!
Hello and thanks for providing this lovely tool…
We use it succesful in diffrent projects..
Actually we have a problem in one integration :
Its NOT randomizing the questions…. 5 out of a pool of 380… always same questions.
Ironically its doing the randomize for the answers CORRECTLY…
Everything else is fine…any idea to this behaviour?
Sorry…just to be more precise:
It is NOT picking fresh questions randomly…it ALWAYS takes the first 5 questions from the pool.
It is also NOT randomizing the question order…
But IT DOES randomize the answers order…
You can check it on the live site via the link provided..
We are really in the need of an pro tip here….its a bit weired..
Thanks for your support!
Hi Sören,
first, I need to make sure your settings are correct (always important to double check!).
You have a number entered into the Pool of Questions feature (looks like 5
?), and you have nothing entered into the WP Paginate feature (WP Paginate cannot allow random orders).
Assuming the settings are correct…
Since random answers is working, but random questions is not, we can know with 100% certainty that the issue is with how your site is handling queries. Something on your end is preventing HD Quiz from querying questions with the rand
parameter (a query is the database lookup that WordPress does).
This can happen one of two ways.
a) another plugin, or possibly a theme function, is overwriting WordPress queries to always return the same order.
b) something is caching database queries. Possibly a caching plugin on your site, but this issue is most common at the host level. Some hosts even outright disable random database queries on their end (looking at you WPEngine).
HD Quiz uses the suppress_filters
parameter to tell other plugins to not interfere with our queries, but 🤷
What you should do
First, try the HD Quiz definition to force question order.
define("HDQ_FORCE_ORDER", "rand");
Adding the above definition to your theme’s functions.php
file (always make a backup of the file before modifying! If you make a mistake, it will crash your site), will attempt to super force the questions to be random. Just note that this will affect all quizzes.
Another option is to change your permalink structure from “plain” to anything else. Your URLs end with ?page_id=xxxx
which is not good. Go to your site settings => permalink to change. I know that in older version of WordPress, this could cause issues, so it’s worth a shot.
If the above works, then great!
If it doesn’t, then you will need to go down the rabbit hole of fixing this yourself.
Try the debug steps outline here: wordpress debug steps. This will help let you know if the issue is caused by another plugin or your theme.
If issues still happens even with a default WP theme and no other plugins, then the only option available is your host. Your host must be disabling randomized queries, and you’ll have to contact them for support.
Dude…glorious!
Since we use your tool on second site with same plugins and template…this situation was a bit curious….
But with your hint to the query handling i could eliminate it directly…
We had a plugin running POST TYPES ORDER …was the guilty one….
Its a WP network site…so it was difficult to localize…
Maybe also interesting : the plugin was active for olny 1 explicit subsite of the network…NOT the one where we use the quiz!
I would have never expected this…
Thanks for this OUTSTANDING support!
Great, glad you found a solution!
Respond to thread
This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help.
You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.
Submit