FooGallery random sorting issues

FooGallery Documentation

FooGallery random sorting issues

One of the popular features of FooGallery – available in both the Free and Pro versions – is the Gallery Sorting feature. This feature gives you the ability to change how the images in your gallery are arranged by changing the Gallery Sorting options.:

Gallery Sorting on FooGallery

One of the options in the Gallery Sorting feature is the “Random” option, which when selected will sort images randomly every time the page is reloaded. However, for a few groups of users, this feature will not work as expected when enabled. 

When this happens, it is because your hosting provider has disabled random order for WordPress queries. An example of a hosting provider who disables this feature by default for WordPress sites is WPEngine.

To break this down further, what the hosting providers actually do is disable the MySQL option to ORDER BY 1. The ORDER BY 1 is known as an “Ordinal” – the number stands for the column based on the number of columns defined in the SELECT clause. What this important part of a query does is allow users/plugins/themes to randomly order items in a list, and uses the “LIMIT 1” option to print a randomized item from that list.

The reason given by hosting providers who disable the ORDER BY 1 sorting option for MySQL is that ORDER BY 1 is known to cause poor performance if heavily/frequently used. 

Fortunately, the way FooGallery uses this sorting option is in an efficient and limited manner and it will not cause any poor performance or impact your site in any way, no matter how small or large your site is or how much server resources it is currently using.

To get the “Random” sorting feature to work on your site as it should, you will need to ensure that ORDER BY 1 sorting option for MySQL is enabled for your site.

One of the easiest ways you can do so is by getting in touch with the support team of your hosting provider and asking them to enable it for you. Also, many of the hosting providers who disable this feature will add an option to enable it either from the hosting dashboard or from your WordPress site itself, as in the case of WPEngine.

If you are using WPEngine, kindly follow this linked guide on how to enable the MySQL option to ORDER BY 1 from your WordPress admin dashboard.

If you have had the ORDER BY 1 enabled and the issue of the Sorting option not working still persists, kindly get in touch with us at support@fooplugins.com and we’ll assist you with this.