diff --git a/changelog/fix-course-structure-exposing-lesson-initial-content b/changelog/fix-course-structure-exposing-lesson-initial-content new file mode 100644 index 0000000000..cee83fd94f --- /dev/null +++ b/changelog/fix-course-structure-exposing-lesson-initial-content @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix the course structure API exposing the lesson AI generated bootstrap text diff --git a/includes/class-sensei-course-structure.php b/includes/class-sensei-course-structure.php index b6f6e3aa34..02432a5691 100644 --- a/includes/class-sensei-course-structure.php +++ b/includes/class-sensei-course-structure.php @@ -187,7 +187,9 @@ private function prepare_lesson( WP_Post $lesson_post ): array { 'title' => $lesson_post->post_title, 'draft' => 'draft' === $lesson_post->post_status, 'preview' => Sensei_Utils::is_preview_lesson( $lesson_post->ID ), - 'initialContent' => get_post_meta( $lesson_post->ID, '_initial_content', true ), + 'initialContent' => current_user_can( 'edit_lesson', $lesson_post->ID ) + ? get_post_meta( $lesson_post->ID, '_initial_content', true ) + : '', ]; } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 56f312aa8a..289aef4ab6 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -87,6 +87,8 @@ + +