Random sort order not actually random

By: Andrew Christensen | Asked: 05/11/2024
ForumsCategory: General questionsRandom sort order not actually random
Andrew Christensen asked 3 months ago
I have a grid view setup to show 3 entries from the system where two particular fields are set. One is the county and the other is where a particular field has a value greater than or equal to 1. There's something like 260 entries that match these criteria. I set the sort to Random. But EVERY time the page loads, it's ALWAYS the same 3 entries. I changed sort to ascending on another field just to make sure it changes, which it does. But then I set it back to Random and I get the same exact 3 entries I had before. Why does it constantly return the same 3 entries. Is there some sort of db caching going on?
1 Answers
Victor Font answered 2 months ago
There's not enough information to help with a diagnosis. How have you confirmed there are 260 matching entries? Troubleshooting a SQL query often requires testing in PHPMyAdmin and comparing your query with the query Formidable generates. You can see Formidable's query by setting a break point in the frm_view_order filter.
Victor Font replied 2 months ago

Strategy 11 released Visual Views 5.6 with this changelog note: "Views sorted by random are now randomized with PHP instead of with SQL. This fixes a conflict with WP Engine hosting where ordering by random using SQL is disabled."

Apparently WP Engine and perhaps other hosts have disabled the MySQL RAND() function presumably as a performance improvement. Are you being hosted on WPEngine?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right