Introduction
By default, BuddyBoss does not provide an option to change the order of courses on the profile page. You can, however, sort the courses using a custom field like course_order and a small custom code snippet in your child theme. This guide explains how you can order courses on the BuddyBoss profile page.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- In your WordPress admin dashboard, go to Appearance > Theme Editor.
- Under Select theme to edit, choose your active child theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
function custom_buddyboss_my_courses_ordering( $args, $user_id ) {
// Modify the query only for the "My Courses" section
$args['meta_key'] = 'course_order'; // Custom field for the course order
$args['orderby'] = 'meta_value_num'; // Sorting by the course order value (numeric)
$args['order'] = 'ASC'; // Change to 'DESC' if you want descending order
return $args;
}add_filter( ‘ld_profile_query_args’, ‘custom_buddyboss_my_courses_ordering’, 10, 2 );
- Click Update File to save your changes.
Adding the Custom Field for Course Order
- Go to LearnDash LMS > Courses in your WordPress dashboard.
- Edit each course.
- Scroll down to the Custom Fields section.
- Add a custom field named course_order and assign it a value (e.g., 1 for the first course, 2 for the second, etc.).
- Save the course.
Troubleshooting and FAQs
Q: Courses are not sorted as expected, what should I check?
A: Make sure the course_order custom field exists for each course and has numeric values.
Q: Can I change the sorting to descending order?
A: Yes, change ‘ASC’ to ‘DESC’ in the code snippet.
Q: Will this affect other parts of the site?
A: No, this only affects the “My Courses” section in the user profile.
Q: Can I revert this change easily?
A: Yes, remove the code from functions.php and save.
Q: Who can I contact for further assistance?
A: Check the BuddyBoss Support Policy or consult a developer.