<?php
+
+use Sensei\Internal\Emails\Email_Post_Type;
+
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
@@ -144,6 +147,7 @@ Source: includes/class-sensei-posttypes.php
// REST API functionality.
add_action( 'rest_api_init', [ $this, 'setup_rest_api' ] );
+ add_filter( 'rest_post_search_query', [ $this, 'exclude_post_types_from_rest_search' ] );
// Add protections on feeds for certain CPTs.
add_action( 'wp', [ $this, 'protect_feeds' ] );
@@ -161,7 +165,7 @@ Source: includes/class-sensei-posttypes.php
/**
* Graceful fallback for deprecated properties.
*
- * @since $$next-version$$
+ * @since 4.24.4
*
* @param string $key The key to get.
*
@@ -210,6 +214,28 @@ Source: includes/class-sensei-posttypes.php
add_filter( 'post_password_required', [ $this, 'lesson_is_protected' ], 10, 2 );
}
+ /**
+ * Exclude post types from the REST API search.
+ *
+ * @since 4.24.4
+ * @access private
+ *
+ * @param array $args The query args.
+ * @return array The modified query args.
+ */
+ public function exclude_post_types_from_rest_search( $args ) {
+ $excluded_post_types = [
+ 'sensei_message',
+ Email_Post_Type::POST_TYPE,
+ ];
+
+ if ( isset( $args['post_type'] ) ) {
+ $args['post_type'] = array_diff( (array) $args['post_type'], $excluded_post_types );
+ }
+
+ return $args;
+ }
+
/**
* Add protection to Sensei post type feeds.
*
diff --git a/includes_class-sensei-quiz.php.html b/includes_class-sensei-quiz.php.html
index 515126c97b..4894036c35 100644
--- a/includes_class-sensei-quiz.php.html
+++ b/includes_class-sensei-quiz.php.html
@@ -146,7 +146,7 @@ Source: includes/class-sensei-quiz.php
*
* @internal
*
- * @since $$next-version$$
+ * @since 4.24.4
* @return void
*/
public function enqueue_styles() {
diff --git a/includes_class-sensei-settings-api.php.html b/includes_class-sensei-settings-api.php.html
index e3feaadfdf..360f8df248 100644
--- a/includes_class-sensei-settings-api.php.html
+++ b/includes_class-sensei-settings-api.php.html
@@ -173,7 +173,7 @@ Source: includes/class-sensei-settings-api.php
/**
* Graceful fallback for deprecated properties.
*
- * @since $$next-version$$
+ * @since 4.24.4
*
* @param string $key The key to get.
*
diff --git a/includes_class-sensei-teacher.php.html b/includes_class-sensei-teacher.php.html
index 5cc1d326ec..80ba18cbf0 100644
--- a/includes_class-sensei-teacher.php.html
+++ b/includes_class-sensei-teacher.php.html
@@ -874,7 +874,7 @@ Source: includes/class-sensei-teacher.php
/**
* Filter the course IDs associated with a given teacher.
*
- * @since $$next-version$$
+ * @since 4.24.4
*
* @hook sensei_teacher_course_ids
*
diff --git a/sensei_%7B$post_type%7D_initial_publish.html b/sensei_%7B$post_type%7D_initial_publish.html
index 06a9c4d196..b9e23c1a36 100644
--- a/sensei_%7B$post_type%7D_initial_publish.html
+++ b/sensei_%7B$post_type%7D_initial_publish.html
@@ -144,7 +144,7 @@ Parameters:
Source:
diff --git a/sensei_course_category_slug.html b/sensei_course_category_slug.html
index 3efdc56715..5c160c079b 100644
--- a/sensei_course_category_slug.html
+++ b/sensei_course_category_slug.html
@@ -141,7 +141,7 @@ Parameters:
Source:
diff --git a/sensei_course_slug.html b/sensei_course_slug.html
index 277ca6db24..c98c784ed1 100644
--- a/sensei_course_slug.html
+++ b/sensei_course_slug.html
@@ -315,7 +315,7 @@ Parameters:
Source:
diff --git a/sensei_learners_allowed_user_ids.html b/sensei_learners_allowed_user_ids.html
index 497ee9077a..1cb19dcd25 100644
--- a/sensei_learners_allowed_user_ids.html
+++ b/sensei_learners_allowed_user_ids.html
@@ -142,7 +142,7 @@ Parameters:
Since:
-
+
diff --git a/sensei_lesson_show_actions.html b/sensei_lesson_show_actions.html
index c678e3dce6..5b661ff651 100644
--- a/sensei_lesson_show_actions.html
+++ b/sensei_lesson_show_actions.html
@@ -164,7 +164,7 @@ Parameters:
Since:
-
+
diff --git a/sensei_lesson_slug.html b/sensei_lesson_slug.html
index 3cba49794e..60bedc380c 100644
--- a/sensei_lesson_slug.html
+++ b/sensei_lesson_slug.html
@@ -141,7 +141,7 @@ Parameters:
Source:
diff --git a/sensei_lesson_tag_slug.html b/sensei_lesson_tag_slug.html
index c5dcf7747b..093a1350c0 100644
--- a/sensei_lesson_tag_slug.html
+++ b/sensei_lesson_tag_slug.html
@@ -141,7 +141,7 @@ Parameters:
Source:
diff --git a/sensei_messages_slug.html b/sensei_messages_slug.html
index 6b6863e1e4..5f264ee14c 100644
--- a/sensei_messages_slug.html
+++ b/sensei_messages_slug.html
@@ -141,7 +141,7 @@ Parameters:
Source:
diff --git a/sensei_multiple_question_slug.html b/sensei_multiple_question_slug.html
index cc355b5ed8..20a654390b 100644
--- a/sensei_multiple_question_slug.html
+++ b/sensei_multiple_question_slug.html
@@ -141,7 +141,7 @@ Parameters:
Source:
diff --git a/sensei_pro_groups_menu_item.html b/sensei_pro_groups_menu_item.html
index 60333890e4..4a1a61cc8d 100644
--- a/sensei_pro_groups_menu_item.html
+++ b/sensei_pro_groups_menu_item.html
@@ -95,7 +95,7 @@