Skip Navigation

[Resolved] Randomized View Order Sorting is not Randomizing Post Selection

This thread is resolved. Here is a description of the problem and solution.

Problem:

View's Randomize ordering does not take affect.

Solution:

The customer uses WP Engine. WP Engine has an option to disable the RAND operator from WP_Query which is how Toolset uses the randomization feature.

Enable ORDERBY RAND() on WP Engine.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by zacharyL 4 months, 1 week ago.

Assigned support staff: Christopher Amirian.

Author
Posts
#2418543
Screenshot 2022-07-15 at 16-05-14 Edit View ‹ AG Aegis Company Inc. — WordPress.png

I have a testimonial slider where the client requested to have a random selection of eight testimonial posts be displayed at any given time within the slider. Since they had an over abundance of responses from their clients, they didn't want to leave anybody out by only posting the eight newest ones. Having a random selection served on page load seemed like the most logical compromise as opposed to putting every single testimonial response up.

My current implementation uses two views, one that displays the posts, and the other that maintains the dot controls. The displayed posts are really what's important here, and so I have the sort order configured to "Random Order" however, the order doesn't get randomized. In fact it's just sorting them from oldest to newest (based on the Post Date). Please see the attached screenshot to confirm my view's configuration.

Here's the page in question hidden link

I'm using Toolset Blocks with the classic Views enabled, and no legacy Toolset plugins are in use on this site.

I've tried making sure the view isn't cached with the attribute cached="off", I've refreshed browser caches, on-site caches from WP Rocket, as well as server level caches, tried viewing in incognito tabs and via hidden link and none of it seems to make a difference.

Any help in this matter would be greatly appreciated, thanks!

#2419203

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Would you please follow the steps below to make sure your Toolset plugins are up to date?

- IMPORTANT STEP! Create a backup of your website.
- Go to "WordPress Dashboard > Plugins > Add new > Commercial (tab)".
- Update Toolset and its addons there.

After that, please test for a possible plugin conflict:

- IMPORTANT STEP! Create a backup of your website.
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

If the problem persists, I'd appreciate it if you could create a staging version of your website and get back to us with the login information for further investigation.

#2420457

Christopher Amirian
Supporter

Languages: English (English )

Screen Shot 2022-08-02 at 11.03.58.png
rand.png

Hi there,

Thank you very much for the test. As it is working ok with the staging version there is not much we can do accessing the staging version.

I suggest that you ask about this from WP Engine. I'd appreciate it if you phrase your question this way:

I use the RAND order in the WP_Query to retrieve my posts. It works ok on another server but it is not on WP Engine would you please tell me what should I do to force the RAND operator to work ok on WP Engine?

In the quote above I did not name Toolset at all, because in the end Toolset uses the normal WP_Query functionality of WordPress to retrieve the posts and it uses the standard RAND operator.

If you phrase the question that way it will remove the burden from Toolset and make the question about a standard WordPress feature.

Thanks

#2429087

WPEngine helped me find a solution. Apparently they have a setting that disables the RAND operator by default, to save on server resources I guess, so it's just a simple matter of toggling the switch to the enable it.

Thanks for your assistance!