Opened 7 years ago
Last modified 7 years ago
#41725 new defect (bug)
User Search Box disappears if searched with 0 (zero)
Reported by: | subrataemfluence | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.8.1 |
Component: | Users | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
If I search users with "0" in search box, the search box disappears after the search is performed and there is no way of doing another search without reloading user list or going back!
If I enter any other value like 999999, -200, xyz etc. no user is fetched, which is fine. But the search box remains visible. It only disappears for 0
.
Line nos. 347 and 348 in /wp-admin/includes/class-wp-list-table.php has this:
<?php public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) return; ... }
If I understand correctly, according to https://developer.wordpress.org/reference/classes/wp_list_table/search_box/ and https://developer.wordpress.org/reference/classes/wp_list_table/has_items/, (&& !$this->has_items()
) looks whether the table has items to display or not, where the first link is responsible for rendering the search_box.
So when I enter such a value for which there will no record fetched, should not render the search box after search is performed, but as I said, it is happening only for 0
Commenting out the above if block prevents search box from disappearing. The search box should remain visible irrespective of values entered into it.
Search box is visible with search keyword other than zero (0)