Discover in this tutorial how to get Sensei’s lessons to be displayed sorted by title using code.
If you are using the Sensei LMS plugin as a learning manager, it is possible that after updating the plugin (or installing another one) you may have noticed that the lessons were not ordered as they should be.
Luckily, with a little bit of code you can “force” them to be sorted by title (or whatever you decide).
Let’s see how.
Snippet to sort Sensei LMS lessons by title
Add the following code snippet to your functionality plugin:
Thanks to the
pre_get_posts filter you make sure that the lessons are displayed sorted by title.
If instead of sorting by title you want to sort by another parameter (date…) you can use other WP_Query parameters
Do you want to make sure that Sensei LMS lessons are displayed sorted by title? Now you know how to achieve this by adding a simple snippet.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂