How do I change the permalink names like “/lesson” and “/course”?
Have you ever wondered how you can change the /course permalink on your LifterLMS website? Look no further, we are teaching you how to do that here.
LifterLMS naturally uses the /course permalink to identify that this is a course. For example, your course link can look this way: domain.com/course/this-is-your-course. For some, they don’t want to use the word “course” in their permalink structure.
If you do decide to change the “course” in the permalink, then here’s how to go about it.
- Your LifterLMS powered website.
- A code plugin(LifterLMS Customizations or Code Snippets should do here)
- The code itself
There are steps involved in making sure you do this the right way. Please, always back up your site just incase anything goes wrong and breaks anything(I highly doubt it)
- Login to your website
- Go to plugins >> Add new (Install and activate your preferred code plugin) – Could be LifterLMS Customizations or Code Snippets
- Insert this code in the PHP code editor plugin you have just installed and activated:
add_filter( ‘lifterlms_register_post_type_course’, ‘my_custom_course_settings’ );
function my_custom_course_settings( $obj ) {
$obj[‘rewrite’][‘slug’] = _x( ‘Your Course Name’, ‘course link slug’, ‘my-text-domain’ );
return $obj;
}
Replace “Insert Course name” with the desired new name. This means if you want it to read domain.com/machines/this-is-my-course then you would have to change that to machines and save it.
Once this is done, the last step will be to flush your permalinks. We have a guide here to help: https://lifterlms.com/docs/how-to-flush-wordpress-rewrite-rules-or-permalinks/
There are steps involved in making sure you do this the right way. Please, always back up your site just incase anything goes wrong and breaks anything(I highly doubt it)
- Login to your website
- Go to plugins >> Add new (Install and activate your preferred code plugin) – Could be LifterLMS Customizations or Code Snippets
- Insert this code in the PHP code editor plugin you have just installed and activated:
add_filter( ‘lifterlms_register_post_type_lesson’, ‘my_custom_lesson_settings’ );
function my_custom_lesson_settings( $obj ) {
$obj[‘rewrite’][‘slug’] = _x( ‘Your Lesson Name’, ‘lesson link slug’, ‘my-text-domain’ );
return $obj;
}
Replace “Your Lesson Name” with the desired new name. This means if you want it to read domain.com/tutorials/this-is-my-course then you would have to change that to tutorials and save it.
Once this is done, the last step will be to flush your permalinks. We have a guide here to help: https://lifterlms.com/docs/how-to-flush-wordpress-rewrite-rules-or-permalinks/