My DataTables View is not sorting properly

When creating or editing a View with the DataTables Extension, you can specify a field to sort by and a sort direction like so:

Setting the field and direction to use for sorting a DataTables View

Due to the way the DataTables Extension stores information using the browser, the View may retain a sort setting. 

To clear sorting, add ?cache to the end of the View URL. For example, https://example.com/view/datatables-sort/ becomes https://example.com/view/datatables-sort/?cache — this will force the browser to reload the View without sorting.

You can also permanently fix this by adding the following code to your theme's functions.php file:

If you're not sure how to add code samples to your website, please see the following article: Where to put code samples

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.