| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | 'default' => 'all', |
| 74 | 74 | ], |
| 75 | 75 | 'search' => [ |
| 76 | 76 | 'type' => 'string', |
| 77 | - 'description' => __( 'Search entries by entry ID.', 'sureforms' ), | |
| 77 | + 'description' => __( 'Search entries by entry ID, form title, or submitted form data. Text search requires at least 3 characters; numeric terms match the entry ID exactly.', 'sureforms' ), | |
| 78 | 78 | ], |
| 79 | 79 | 'date_from' => [ |
| 80 | 80 | 'type' => 'string', |
| 81 | 81 | 'description' => __( 'Start date for filtering entries (YYYY-MM-DD format).', 'sureforms' ), |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | ], |
| 97 | 97 | 'orderby' => [ |
| 98 | 98 | 'type' => 'string', |
| 99 | 99 | 'description' => __( 'Column to order results by.', 'sureforms' ), |
| 100 | - 'enum' => [ 'created_at', 'ID', 'form_id', 'status' ], | |
| 100 | + 'enum' => [ 'created_at', 'ID', 'id', 'form_id', 'status' ], | |
| 101 | 101 | 'default' => 'created_at', |
| 102 | 102 | ], |
| 103 | 103 | 'order' => [ |
| 104 | 104 | 'type' => 'string', |
| @@ -153,9 +153,11 @@ | ||
| 153 | 153 | |
| 154 | 154 | $args = [ |
| 155 | 155 | 'form_id' => Helper::get_integer_value( $input['form_id'] ?? 0 ), |
| 156 | 156 | 'status' => ! empty( $input['status'] ) ? sanitize_text_field( Helper::get_string_value( $input['status'] ) ) : 'all', |
| 157 | - 'search' => ! empty( $input['search'] ) ? sanitize_text_field( Helper::get_string_value( $input['search'] ) ) : '', | |
| 157 | + // isset(), not ! empty(): a literal "0" search is a valid term and must not be | |
| 158 | + // dropped (which would return every entry). Mirrors the REST path. | |
| 159 | + 'search' => isset( $input['search'] ) ? sanitize_text_field( Helper::get_string_value( $input['search'] ) ) : '', | |
| 158 | 160 | 'date_from' => ! empty( $input['date_from'] ) ? sanitize_text_field( Helper::get_string_value( $input['date_from'] ) ) : '', |
| 159 | 161 | 'date_to' => ! empty( $input['date_to'] ) ? sanitize_text_field( Helper::get_string_value( $input['date_to'] ) ) : '', |
| 160 | 162 | 'per_page' => $per_page, |
| 161 | 163 | 'page' => isset( $input['page'] ) ? Helper::get_integer_value( $input['page'] ) : 1, |