Opened 23 months ago
Last modified 4 months ago
#43656 new defect (bug)
Media attachment filter does not work after switching list mode to grid for image attachment filter
Reported by: | itzmekhokan | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | 4.9.4 |
Component: | Media | Keywords: | has-screenshots needs-patch dev-feedback |
Focuses: | Cc: | ||
PR Number: |
Description
On media library if you switch to List mode and try to filter by image type attachment filter, it's perfectly filtered by image type in list mode.
Now at this time try to switch media mode to Grid, you will see all the attachments filtered by image type. And now if you try to filter by any attachments type filter in grid mode, it does not work. Only faced this issue for image type filter for switching mode List to Grid. Rest of attachments filters works perfectly in above case.
Attachments (3)
Change History (7)
#2
@
22 months ago
- Severity changed from normal to major
I can confirm this bug!
It is caused by the presence of the "attachment-filter" in the URL, if it has any value other than empty.
The href attribute of the "view-switch" icon (id:'view-switch-grid') holds all the query parameters, which are then (falsely) used for the ajax query.
And if the first query for grid view does have a value for "attachment-filter", then you'll never be able to see "all" media!
BTW: The ajax query is also totally "buggy". Normally one should be able to change the $query parameter byy using the 'ajax_query_attachments_args' filter. But this will have no effect for most of the query parameters, because some of them are hardcoded elsewhere in core!!!
So there is no easy fix for this. Because to get it right, I would also expect the mime-type selection drop-down to be set to choosen value from the list view (and of course to work for "all").
Also one should think about the trash option (if enabled), where all other filters should be ignored.
@
4 months ago
Switching to Grid view - the dropwdown shows "All media" but the output is still just "Documents" because of attachment-filter in URL
After filter by image type from media attachment filter and then after switching mode list to grid attachment filter doesn't work in grid filter