Support » Plugin: Sensei LMS » Change Post Type Permalinks

  • Resolved pimg


    The site we are trying out this plugin on uses “/blog/%postname%/” custom structure for permalinks so our blogs are all nested. This unfortunately makes all courses and lessons in Sensei also nest with /blog/ before their URLs which is very undesirable. I was able to easily fix this by editing class-sensei-posttypes.php and changing rewrite -> “with_front’ to false when registering the post types but this of course is not update proof and a hot fix at best. Can this be added in permanently since theres not really a reason to keep that in place when registering the post types or a setting in place to set that value to false if needed?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pimg


    @renathoc is this something that can be looked into?

    Plugin Author Renatho


    Hi @pimg!

    Thank you for contact us with your question!

    There is a safer solution, where you can override the post type arguments through your own code. So you can update the plugin without problems.

    You can add the following snippet to your theme functions.php or another place that you prefer (there is a plugin for it if you want:

    function sensei_update_rewrites_without_front( $args ) {
    	$args['rewrite']['with_front'] = false;
    	return $args;
    add_filter( 'sensei_register_post_type_course', 'sensei_update_rewrites_without_front' );
    add_filter( 'sensei_register_post_type_lesson', 'sensei_update_rewrites_without_front' );
    add_filter( 'sensei_register_post_type_quiz', 'sensei_update_rewrites_without_front' );
    add_filter( 'sensei_register_post_type_question', 'sensei_update_rewrites_without_front' );

    It will override the with_front for the courses, lessons, quizzes, and questions! 😉

    After the changes, remember to go to the Settings > Permalinks and save it again to flush the permalinks of your site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Post Type Permalinks’ is closed to new replies.