| @@ -49,12 +49,10 @@ | ||
| 49 | 49 | 'required' => true, |
| 50 | 50 | 'type' => 'string', |
| 51 | 51 | 'description' => 'Post type to search.', |
| 52 | 52 | 'sanitize_callback' => 'sanitize_key', |
| 53 | - // Public route: only a post type visitors can already | |
| 54 | - // see may be searched, never an internal one. | |
| 55 | 53 | 'validate_callback' => function( $param ) { |
| 56 | - return 'any' === $param || is_post_type_viewable( (string) $param ); | |
| 54 | + return $param === 'any' || post_type_exists( $param ); | |
| 57 | 55 | }, |
| 58 | 56 | ), |
| 59 | 57 | ), |
| 60 | 58 | ) |
| @@ -68,11 +66,9 @@ | ||
| 68 | 66 | $current_page_id = $request->get_param( 'current_page_id' ); |
| 69 | 67 | |
| 70 | 68 | $args = array( |
| 71 | 69 | 's' => $searchQuery, |
| 72 | - // A public, repeatable request must not render every matching post. | |
| 73 | - 'posts_per_page' => max( 1, (int) apply_filters( 'ablocks/search/max_results', 20, $source ) ), | |
| 74 | - 'no_found_rows' => true, | |
| 70 | + 'posts_per_page' => -1, | |
| 75 | 71 | 'post_type' => $source, |
| 76 | 72 | 'post_status' => 'publish', |
| 77 | 73 | ); |
| 78 | 74 | |