Skip to content

Commit

Permalink
= 4.2.6.6 =
Browse files Browse the repository at this point in the history
~ Fixed: search ?s= exclude questions
  • Loading branch information
tungnxt89 committed May 2, 2024
1 parent a09b752 commit 8601f2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
8 changes: 0 additions & 8 deletions inc/class-lp-page-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,14 +781,6 @@ public function pre_get_posts( WP_Query $q ): WP_Query {
$q->set( 'post__not_in', $list_ids_exclude );
}

// Not search questions
$searchable_types = get_post_types();
unset( $searchable_types[ LP_QUESTION_CPT ] );
$q->set(
'post_type',
$searchable_types
);

return $q;
}

Expand Down
29 changes: 15 additions & 14 deletions inc/custom-post-types/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function args_register_post_type(): array {
add_post_type_support( 'question', 'comments' );

return array(
'labels' => array(
'labels' => array(
'name' => esc_html__( 'Question Bank', 'learnpress' ),
'menu_name' => esc_html__( 'Question Bank', 'learnpress' ),
'singular_name' => esc_html__( 'Question', 'learnpress' ),
Expand All @@ -215,23 +215,24 @@ public function args_register_post_type(): array {
'not_found' => esc_html__( 'No questions found', 'learnpress' ),
'not_found_in_trash' => esc_html__( 'There was no questions found in the trash', 'learnpress' ),
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'has_archive' => false,
'capability_type' => LP_LESSON_CPT,
'map_meta_cap' => true,
'show_in_menu' => 'learn_press',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'show_in_rest' => learn_press_user_maybe_is_a_teacher(),
'supports' => array( 'title', 'editor', 'revisions' ),
'hierarchical' => false,
'rewrite' => array(
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'has_archive' => false,
'capability_type' => LP_LESSON_CPT,
'map_meta_cap' => true,
'show_in_menu' => 'learn_press',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'show_in_rest' => learn_press_user_maybe_is_a_teacher(),
'supports' => array( 'title', 'editor', 'revisions' ),
'hierarchical' => false,
'rewrite' => array(
'slug' => 'questions',
'hierarchical' => true,
'with_front' => false,
),
'exclude_from_search' => true,
);
}

Expand Down

0 comments on commit 8601f2f

Please sign in to comment.